Changeset 411:64529b902312

Show
Ignore:
Timestamp:
05/17/2010 05:19:25 PM (21 months ago)
Author:
Sidgyck <sidgyck@…>
Branch:
default
Message:

[NEW]: !muc topic <subject>

Files:
1 modified

Legend:

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

    r410 r411  
    4242        commands << "REPORT" << "MISSING" << "STAT"; 
    4343 
    44         commands << "POKE" << "REALJID" << "INVITE" << "CLEAN"; 
     44        commands << "POKE" << "REALJID" << "INVITE" << "CLEAN" << "TOPIC"; 
    4545        pluginId=1; 
    4646 
     
    631631                myShouldIgnoreError=1; 
    632632                return false; 
     633        } 
     634 
     635        if (cmd=="TOPIC") 
     636        { 
     637                Conference* conf = getConf(s); 
     638                if (!conf) { 
     639                        reply(s, "You are not in conference!"); 
     640                        return true; 
     641                } 
     642                if (arg.isEmpty()) { 
     643                        reply(s, "!muc topic <subject>"); 
     644                        return true; 
     645                } 
     646                parser.back(1); 
     647                arg = parser.joinBody(); 
     648                gloox::Stanza *m = new gloox::Stanza( "message" ); 
     649                m->addAttribute( "to", conf->name().toStdString() ); 
     650                m->addAttribute( "type", "groupchat" ); 
     651                m->addChild(new gloox::Tag("subject", arg.toStdString())); 
     652                bot()->client()->send(m); 
     653                return true; 
    633654        } 
    634655