~ubuntu-branches/ubuntu/trusty/irssi-plugin-xmpp/trusty-proposed

« back to all changes in this revision

Viewing changes to debian/xmpp-admin.pl

  • Committer: Package Import Robot
  • Author(s): Florian Schlichting, Florian Schlichting
  • Date: 2014-01-03 00:25:20 UTC
  • mfrom: (1.3.6)
  • Revision ID: package-import@ubuntu.com-20140103002520-zc3sfydzt1wp03i0
Tags: 0.52+git20140102-1
[ Florian Schlichting ]
* Import Upstream version 0.52+git20140102
* Add VCS-* fields for collab-maint on alioth
* Add upstream git URL to Source field in debian/copyright
* Drop patches plucked from upstream CVS
* Refresh hardening.patch (offset, drop hunk fixed upstream)
* Provide xmpp-admin.pl script by Seth Difley
* Add GTalk-MUC-support.patch, plucked from github/freemandrew
* Add support for XMPP-PGP, plucked from github/singpolyma
* New useless-dependency-on-libidn.patch, to fix a lintian warning
* Declare compliance with Debian Policy 3.9.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# xmpp-admin.pl
 
2
#copy into .irssi/scripts
 
3
#load in irssi with: /script load xmpp-admin
 
4
use Irssi;
 
5
 
 
6
$::VERSION='0.0.1';
 
7
%::IRSSI = (
 
8
    authors => 'Seth Difley',
 
9
    contact => '',
 
10
    name => 'xmpp-admin',
 
11
    description => 'Adds admin commands to irssi-xmpp',
 
12
    url => '',
 
13
    license => 'GNU General Public License',
 
14
    changed => '$Date$'
 
15
    );
 
16
 
 
17
#/affiliate affiliation_level [jid]
 
18
#If jid is absent, the affiliation list is returned (Raw xml messages must be active to see the list.)
 
19
sub cmd_affiliate {
 
20
    my ($data,$server,$wid) = @_;
 
21
    @items = split(" ", $data);
 
22
    if ($items[0]) {
 
23
        if ($items[1]) {
 
24
            $affil = "QUOTE <iq type=\'set\' id=\'affiliate_set\' to=\'$wid->{name}\'> <query xmlns=\'http://jabber.org/protocol/muc#admin\'> <item jid=\'$items[1]\' affiliation=\'$items[0]\'/> </query> </iq>";
 
25
        }
 
26
        else {
 
27
            $affil = "QUOTE <iq type=\'get\' id=\'affiliate_get\' to=\'$wid->{name}\'> <query xmlns=\'http://jabber.org/protocol/muc#admin\'> <item affiliation=\'$items[0]\'/> </query> </iq>";
 
28
        }
 
29
        $server->command("$affil");
 
30
    }
 
31
    else {
 
32
        Irssi::active_win()->print("/affiliate none|owner|admin|member|outcast [jid]");
 
33
    }
 
34
}
 
35
 
 
36
#/role role_level nickname [reason]
 
37
sub cmd_role {
 
38
    my ($data,$server,$wid) = @_;
 
39
    @items = split(" ", $data);
 
40
    if ($items[1]) {
 
41
        if ($items[2]) {
 
42
            $data =~ s/^.*?[\s]+.*?[\s]+//;
 
43
            $reason = "<reason>$data</reason>";
 
44
        }
 
45
        else {
 
46
            $reason = "";
 
47
        }
 
48
        $role = "QUOTE <iq type=\'set\' id=\'role_set\' to=\'$wid->{name}\'> <query xmlns=\'http://jabber.org/protocol/muc#admin\'> <item nick=\'$items[1]\' role=\'$items[0]\'> $reason </item> </query> </iq>";
 
49
        $server->command("$role");
 
50
    }
 
51
    else {
 
52
        Irssi::active_win()->print("/role none|moderator|participant|visitor nickname [reason]");
 
53
    }
 
54
}
 
55
 
 
56
#/kick nickname [reason]
 
57
sub cmd_kick {
 
58
    my ($data,$server,$wid) = @_;
 
59
    @items = split(" ", $data);
 
60
    if ($items[0]) {
 
61
        cmd_role("none " . $data,$server,$wid);
 
62
    }
 
63
    else {
 
64
        Irssi::active_win()->print("/kick nickname [reason]");
 
65
    }
 
66
}
 
67
 
 
68
Irssi::command_bind('affiliate', \&cmd_affiliate);
 
69
Irssi::command_bind('role', \&cmd_role);
 
70
Irssi::command_bind('kick', \&cmd_kick);