Changeset 196:34ff4b571ecd
- Timestamp:
- 04/19/2008 04:32:38 PM (4 years ago)
- Author:
- Dmitry Nezhevenko <dion@…>
- Branch:
- default
- Message:
-
Word: showpriv command to send info message to specified JID
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r175
|
r196
|
|
| 10 | 10 | BasePlugin(parent) |
| 11 | 11 | { |
| 12 | | commands << "ADD" << "COUNT" << "CLEAR" << "SHOW" << "SHOWPRIV" << "DEL"; |
| | 12 | commands << "ADD" << "COUNT" << "CLEAR" << "SHOW" << "SHOWPRIV" << "SHOWJID" << "DEL"; |
| 13 | 13 | } |
| 14 | 14 | |
| … |
… |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | | qDebug() << "DEST=" << dest; |
| 81 | 80 | QString jid=bot()->getJID(s, dest); |
| 82 | 81 | if (jid.isEmpty()) |
| … |
… |
|
| 101 | 100 | } |
| 102 | 101 | |
| | 102 | if (cmd=="SHOWJID") |
| | 103 | { |
| | 104 | QString dest=parser.nextToken(); |
| | 105 | QString word=parser.nextToken(); |
| | 106 | |
| | 107 | if (dest.isEmpty() || word.isEmpty()) |
| | 108 | { |
| | 109 | reply(s, "Syntax: SHOWJID <JID> <WORD>"); |
| | 110 | return true; |
| | 111 | } |
| | 112 | if (getRole(s)<ROLE_MODERATOR) |
| | 113 | { |
| | 114 | reply(s, "You should be at least moderator to do this"); |
| | 115 | return true; |
| | 116 | } |
| | 117 | |
| | 118 | QString nick; |
| | 119 | QString value=words.get(bot()->getStorage(s), word, &nick); |
| | 120 | if (value.isEmpty()) |
| | 121 | { |
| | 122 | reply(s, "I don't know"); |
| | 123 | return true; |
| | 124 | } |
| | 125 | reply(s, "Ok"); |
| | 126 | s->addAttribute("from", dest.toStdString()); |
| | 127 | s->finalize(); |
| | 128 | |
| | 129 | QString toSay=QString("%1 says that %2 = %3").arg(nick).arg(word).arg(value); |
| | 130 | reply(s, toSay, true); |
| | 131 | return true; |
| | 132 | } |
| | 133 | |
| 103 | 134 | if (cmd=="SHOWALL") |
| 104 | 135 | { |