Changeset 419:cb5b57b7e390
- Timestamp:
- 06/23/2010 09:41:38 PM (20 months ago)
- Author:
- Dmitry Nezhevenko <dion@…>
- Branch:
- default
- Parents:
- 416:919e547ea0c9 (diff), 417:b139596e0b24 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
- Message:
-
merge
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r415
|
r419
|
|
| 26 | 26 | |
| 27 | 27 | #include <iostream> |
| | 28 | #include <memory> |
| 28 | 29 | |
| 29 | 30 | #include <gloox/stanza.h> |
| … |
… |
|
| 2650 | 2651 | |
| 2651 | 2652 | bool validJID = false; |
| 2652 | | gloox::Tag *m = new gloox::Tag( "message" ); |
| | 2653 | std::auto_ptr<gloox::Tag> m (new gloox::Tag( "message" )); |
| 2653 | 2654 | m->addAttribute( "to", conf->name().toStdString() ); |
| 2654 | | gloox::Tag *x = new gloox::Tag( m, "x" ); |
| | 2655 | gloox::Tag *x = new gloox::Tag( m.get(), "x" ); |
| 2655 | 2656 | x->addAttribute( "xmlns", "http://jabber.org/protocol/muc#user" ); |
| 2656 | 2657 | |
| … |
… |
|
| 2672 | 2673 | new gloox::Tag( x, "password", pass.toStdString() ); |
| 2673 | 2674 | |
| 2674 | | return (new gloox::Stanza(m)); |
| 2675 | | } |
| | 2675 | return (new gloox::Stanza(m.get())); |
| | 2676 | } |
-
|
r417
|
r419
|
|
| 35 | 35 | { |
| 36 | 36 | commands << "WHEREAMI" << "NICK" << "IDLE" << "KNOWN" << "JOIN" << "LEAVE" |
| 37 | | << "KICK" << "VISITOR" << "PARTICIPANT" << "MODERATOR" << "BAN" |
| 38 | | << "BANJID" << "UNBAN" << "NONE" << "MEMBER" << "ADMIN" << "OWNER"; |
| | 37 | << "KICK" << "VISITOR" << "PARTICIPANT" << "MODERATOR" << "BAN" |
| | 38 | << "BANJID" << "UNBAN" << "NONE" << "MEMBER" << "ADMIN" << "OWNER"; |
| 39 | 39 | commands << "ABAN" << "AKICK" << "AVISITOR" << "ACMD" << "AMODERATOR" << "APARTICIPANT" << "AFIND" |
| 40 | | << "ATRACE" << "SEEN" << "SEENEX" << "CLIENTS" << "SETNICK" << "CHECKVCARD" << "ROLE" << "VERSION"; |
| | 40 | << "ATRACE" << "SEEN" << "SEENEX" << "SEENJID" << "CLIENTS" << "SETNICK" << "CHECKVCARD" << "ROLE" << "VERSION"; |
| 41 | 41 | commands << "HERE" << "STATUS" << "AGE" << "AGESTAT"; |
| 42 | 42 | |
| 43 | 43 | commands << "REPORT" << "MISSING" << "STAT"; |
| 44 | 44 | |
| 45 | | commands << "POKE" << "REALJID" << "INVITE" << "CLEAN" << "TOPIC"; |
| | 45 | commands << "POKE" << "REALJID" << "INVITE" << "CLEAN" << "TOPIC" << "VISITS"; |
| 46 | 46 | pluginId=1; |
| 47 | 47 | |
| … |
… |
|
| 634 | 634 | } |
| 635 | 635 | |
| 636 | | if (cmd=="TOPIC") |
| | 636 | if (cmd=="VISITS" || cmd=="VISITSEX") |
| 637 | 637 | { |
| 638 | 638 | Conference* conf = getConf(s); |
| … |
… |
|
| 641 | 641 | return true; |
| 642 | 642 | } |
| | 643 | QString arg2 = parser.nextToken(); |
| | 644 | QStringList list; |
| | 645 | QDateTime from = QDateTime::fromString(arg, Qt::ISODate); |
| | 646 | QDateTime to = QDateTime::fromString(arg2, Qt::ISODate); |
| | 647 | if (!to.isValid()) |
| | 648 | to = QDateTime::currentDateTime(); |
| | 649 | if (!from.isValid()) |
| | 650 | from = QDateTime(to.date()); |
| | 651 | |
| | 652 | if (from > to) |
| | 653 | { |
| | 654 | QDateTime tmp = from; |
| | 655 | from = to; |
| | 656 | to = tmp; |
| | 657 | } |
| | 658 | list = conf->visits(from, to, cmd.endsWith("EX")); |
| | 659 | reply(s, QString("over the past %1 there was %2 user%3: %4") |
| | 660 | .arg(secsToString(from.secsTo(to))) |
| | 661 | .arg( list.count() ) |
| | 662 | .arg( list.count() > 1 ?"s":"" ) |
| | 663 | .arg( list.join(", ")) ); |
| | 664 | return true; |
| | 665 | } |
| | 666 | |
| | 667 | if (cmd=="TOPIC") |
| | 668 | { |
| | 669 | Conference* conf = getConf(s); |
| | 670 | if (!conf) { |
| | 671 | reply(s, "You are not in conference!"); |
| | 672 | return true; |
| | 673 | } |
| 643 | 674 | if (arg.isEmpty()) { |
| 644 | 675 | reply(s, "!muc topic <subject>"); |
| | 676 | return true; |
| | 677 | } |
| | 678 | if (!isFromConfModerator(s)) { |
| | 679 | reply(s,"You should be moderator to do this"); |
| 645 | 680 | return true; |
| 646 | 681 | } |
| … |
… |
|
| 652 | 687 | m->addChild(new gloox::Tag("subject", arg.toStdString())); |
| 653 | 688 | bot()->client()->send(m); |
| 654 | | return true; |
| 655 | | } |
| 656 | | |
| | 689 | reply(s, "OK"); |
| | 690 | return true; |
| | 691 | } |
| | 692 | |
| 657 | 693 | if (cmd=="CLEAN") |
| 658 | 694 | { |
| … |
… |
|
| 662 | 698 | return true; |
| 663 | 699 | } |
| 664 | | |
| | 700 | |
| 665 | 701 | if (cmd=="INVITE") |
| 666 | 702 | { |
| … |
… |
|
| 876 | 912 | } |
| 877 | 913 | |
| 878 | | if (cmd=="SEEN" || cmd=="SEENEX") |
| 879 | | { |
| 880 | | if( arg.isEmpty() ) { |
| 881 | | Nick *n = getNick(s); |
| 882 | | if(!n) return true; |
| 883 | | reply(s, conf->seen(n->nick(), "SEENEX" == cmd)); |
| 884 | | return true; |
| 885 | | } |
| 886 | | reply(s, conf->seen(arg, "SEENEX" == cmd)); |
| | 914 | if (cmd=="SEEN" || cmd=="SEENEX" || cmd=="SEENJID" || cmd=="SEENJIDEX") |
| | 915 | { |
| | 916 | if (arg.isEmpty()) |
| | 917 | { |
| | 918 | if (cmd.startsWith("SEENJID")) |
| | 919 | { |
| | 920 | reply(s, "!muc seenjid[ex] <jid>"); |
| | 921 | return true; |
| | 922 | } |
| | 923 | Nick *n = getNick(s); |
| | 924 | if (!n) |
| | 925 | return true; |
| | 926 | reply(s, conf->seen(n->nick(), cmd.endsWith("EX"), false)); |
| | 927 | return true; |
| | 928 | } |
| | 929 | reply(s, conf->seen(arg, cmd.endsWith("EX"), cmd.startsWith("SEENJID"))); |
| 887 | 930 | return true; |
| 888 | 931 | } |