NAME

Bot::Jabbot::Hints - Jabbot Hints

Jabbot Hints

This documentation provides some hints and code snippets for you to use in your modules

Kick user (in muc) use this code in muc message handler to kick user:

my $user='someuser@jabber.org';
$msg->room()->connection()->send_iq('set',
                                            {
                                                defns => 'http://jabber.org/protocol/muc#admin',
                                                node => {
                                                    name => 'query',
                                                    ns=>'http://jabber.org/protocol/muc#admin',
                                                    childs=>[
                                                        {
                                                            name => 'item',
                                                            attrs=>['role','none','nick',$user]
                                                        }
                                                    ]
                                                }
                                            }, undef,to => $msg->room()->jid()
        );

You can also use this code to manipulate user roles

Ban user (in muc) use this code in muc message handler to ban user:

my $user='someuser@jabber.org';
$msg->room()->connection()->send_iq('set',
                                            {
                                                defns => 'http://jabber.org/protocol/muc#admin',
                                                node => {
                                                    name => 'query',
                                                    ns=>'http://jabber.org/protocol/muc#admin',
                                                    childs=>[
                                                        {
                                                            name => 'item',
                                                            attrs=>['affiliation','outcast','jid',$user]
                                                        }
                                                    ]
                                                }
                                            }, undef,to => $msg->room()->jid()
        );

You can also use this code to manipulate user affilations