Changeset 203:71a5efcf776f

Show
Ignore:
Timestamp:
05/11/2008 07:13:57 PM (4 years ago)
Author:
Dmitry Nezhevenko <dion@…>
Branch:
default
Message:

Forward "captcha" messages to bot owner

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/plugins/muc/mucplugin.cpp

    r198 r203  
    114114                if (cmd=="JOIN" || cmd=="LEAVE" || cmd=="WHEREAMI") 
    115115                        return true; 
     116                 
     117                // Possible captcha request from conference server 
     118                QString from=QString::fromStdString(s->from().full()); 
     119                if (from.indexOf('@')<0 && from.indexOf('/') < 0) 
     120                { 
     121                        return true; 
     122                } 
     123                 
    116124                return false; 
    117125        } 
     
    252260        if (parser.isForMe()) 
    253261        { 
     262                 
     263                if (conf==0 && nickName.isEmpty())  
     264                { 
     265                        QString from=QString::fromStdString(s->from().full()).toLower(); 
     266                        if (from.indexOf('@')<0 && from.indexOf('/') < 0) 
     267                        { 
     268                                from=QString("@%1/").arg(from); 
     269                                for (QStringList::iterator it=confInProgress.begin(); it!=confInProgress.end(); ++it) 
     270                                { 
     271                                        QString confName=*it; 
     272                                        if (confName.toLower().indexOf(from)>0) 
     273                                        { 
     274                                                //Captcha request 
     275                                                gloox::JID ownerJid(DataStorage::instance()->getStdString("access/owner")); 
     276                                                gloox::Stanza *outgoing=gloox::Stanza::createMessageStanza(ownerJid,s->body()); 
     277                                                bot()->client()->send(outgoing); 
     278                                                return true; 
     279                                        } 
     280                                } 
     281                        } 
     282                } 
     283                 
    254284                if (cmd=="JOIN") 
    255285                {