Changeset 196:34ff4b571ecd

Show
Ignore:
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:
1 modified

Legend:

Unmodified
Added
Removed
  • src/plugins/word/wordplugin.cpp

    r175 r196  
    1010        BasePlugin(parent) 
    1111{ 
    12         commands << "ADD" << "COUNT" << "CLEAR" << "SHOW" << "SHOWPRIV" << "DEL"; 
     12        commands << "ADD" << "COUNT" << "CLEAR" << "SHOW" << "SHOWPRIV" << "SHOWJID" << "DEL"; 
    1313} 
    1414 
     
    7878                } 
    7979 
    80                 qDebug() << "DEST=" << dest; 
    8180                QString jid=bot()->getJID(s, dest); 
    8281                if (jid.isEmpty()) 
     
    101100        } 
    102101 
     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         
    103134        if (cmd=="SHOWALL") 
    104135        {