Mercurial > prosody-modules
annotate mod_roster_command/mod_roster_command.lua @ 1417:9b6fbababb8c
mod_post_msg: Fix indentation
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 28 May 2014 20:34:57 +0200 |
parents | f806c8a7f985 |
children | f7cb287dd3c7 |
rev | line source |
---|---|
453
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 ----------------------------------------------------------- |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 -- mod_roster_command: Manage rosters through prosodyctl |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 -- version 0.02 |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 ----------------------------------------------------------- |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 -- Copyright (C) 2011 Matthew Wild |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 -- Copyright (C) 2011 Adam Nielsen |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 -- |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 -- This project is MIT/X11 licensed. Please see the |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 -- COPYING file in the source package for more information. |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 ----------------------------------------------------------- |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 |
492
f806c8a7f985
mod_roster_command: Fix traceback and log error message when loaded into Prosody (thanks epaulin)
Matthew Wild <mwild1@gmail.com>
parents:
453
diff
changeset
|
12 if not rawget(_G, "prosodyctl") then |
f806c8a7f985
mod_roster_command: Fix traceback and log error message when loaded into Prosody (thanks epaulin)
Matthew Wild <mwild1@gmail.com>
parents:
453
diff
changeset
|
13 module:log("error", "Do not load this module in Prosody, for correct usage see: http://code.google.com/p/prosody-modules/wiki/mod_roster_command"); |
f806c8a7f985
mod_roster_command: Fix traceback and log error message when loaded into Prosody (thanks epaulin)
Matthew Wild <mwild1@gmail.com>
parents:
453
diff
changeset
|
14 module.host = "*"; |
f806c8a7f985
mod_roster_command: Fix traceback and log error message when loaded into Prosody (thanks epaulin)
Matthew Wild <mwild1@gmail.com>
parents:
453
diff
changeset
|
15 return; |
f806c8a7f985
mod_roster_command: Fix traceback and log error message when loaded into Prosody (thanks epaulin)
Matthew Wild <mwild1@gmail.com>
parents:
453
diff
changeset
|
16 end |
f806c8a7f985
mod_roster_command: Fix traceback and log error message when loaded into Prosody (thanks epaulin)
Matthew Wild <mwild1@gmail.com>
parents:
453
diff
changeset
|
17 |
f806c8a7f985
mod_roster_command: Fix traceback and log error message when loaded into Prosody (thanks epaulin)
Matthew Wild <mwild1@gmail.com>
parents:
453
diff
changeset
|
18 |
453
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
19 -- Workaround for lack of util.startup... |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
20 _G.bare_sessions = _G.bare_sessions or {}; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
21 |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
22 local rostermanager = require "core.rostermanager"; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
23 local storagemanager = require "core.storagemanager"; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
24 local jid = require "util.jid"; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
25 local warn = prosodyctl.show_warning; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
26 |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
27 -- Make a *one-way* subscription. User will see when contact is online, |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
28 -- contact will not see when user is online. |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
29 function subscribe(user_jid, contact_jid) |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
30 local user_username, user_host = jid.split(user_jid); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
31 local contact_username, contact_host = jid.split(contact_jid); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
32 if not hosts[user_host] then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
33 warn("The host '%s' is not configured for this server.", user_host); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
34 return; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
35 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
36 storagemanager.initialize_host(user_host); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
37 -- Update user's roster to say subscription request is pending... |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
38 rostermanager.set_contact_pending_out(user_username, user_host, contact_jid); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
39 if hosts[contact_host] then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
40 if contact_host ~= user_host then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
41 storagemanager.initialize_host(contact_host); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
42 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
43 -- Update contact's roster to say subscription request is pending... |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
44 rostermanager.set_contact_pending_in(contact_username, contact_host, user_jid); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
45 -- Update contact's roster to say subscription request approved... |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
46 rostermanager.subscribed(contact_username, contact_host, user_jid); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
47 -- Update user's roster to say subscription request approved... |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
48 rostermanager.process_inbound_subscription_approval(user_username, user_host, contact_jid); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
49 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
50 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
51 |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
52 -- Make a mutual subscription between jid1 and jid2. Each JID will see |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
53 -- when the other one is online. |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
54 function subscribe_both(jid1, jid2) |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
55 subscribe(jid1, jid2); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
56 subscribe(jid2, jid1); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
57 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
58 |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
59 -- Unsubscribes user from contact (not contact from user, if subscribed). |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
60 function unsubscribe(user_jid, contact_jid) |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
61 local user_username, user_host = jid.split(user_jid); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
62 local contact_username, contact_host = jid.split(contact_jid); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
63 if not hosts[user_host] then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
64 warn("The host '%s' is not configured for this server.", user_host); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
65 return; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
66 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
67 storagemanager.initialize_host(user_host); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
68 -- Update user's roster to say subscription is cancelled... |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
69 rostermanager.unsubscribe(user_username, user_host, contact_jid); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
70 if hosts[contact_host] then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
71 if contact_host ~= user_host then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
72 storagemanager.initialize_host(contact_host); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
73 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
74 -- Update contact's roster to say subscription is cancelled... |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
75 rostermanager.unsubscribed(contact_username, contact_host, user_jid); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
76 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
77 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
78 |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
79 -- Cancel any subscription in either direction. |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
80 function unsubscribe_both(jid1, jid2) |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
81 unsubscribe(jid1, jid2); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
82 unsubscribe(jid2, jid1); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
83 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
84 |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
85 -- Set the name shown and group used in the contact list |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
86 function rename(user_jid, contact_jid, contact_nick, contact_group) |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
87 local user_username, user_host = jid.split(user_jid); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
88 if not hosts[user_host] then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
89 warn("The host '%s' is not configured for this server.", user_host); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
90 return; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
91 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
92 storagemanager.initialize_host(user_host); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
93 |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
94 -- Load user's roster and find the contact |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
95 local roster = rostermanager.load_roster(user_username, user_host); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
96 local item = roster[contact_jid]; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
97 if item then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
98 if contact_nick then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
99 item.name = contact_nick; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
100 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
101 if contact_group then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
102 item.groups = {}; -- Remove from all current groups |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
103 item.groups[contact_group] = true; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
104 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
105 rostermanager.save_roster(user_username, user_host, roster); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
106 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
107 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
108 |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
109 function module.command(arg) |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
110 local command = arg[1]; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
111 if not command then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
112 warn("Valid subcommands: (un)subscribe(_both) | rename"); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
113 return 0; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
114 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
115 table.remove(arg, 1); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
116 if command == "subscribe" then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
117 subscribe(arg[1], arg[2]); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
118 return 0; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
119 elseif command == "subscribe_both" then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
120 subscribe_both(arg[1], arg[2]); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
121 return 0; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
122 elseif command == "unsubscribe" then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
123 unsubscribe(arg[1], arg[2]); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
124 return 0; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
125 elseif command == "unsubscribe_both" then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
126 unsubscribe_both(arg[1], arg[2]); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
127 return 0; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
128 elseif command == "rename" then |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
129 rename(arg[1], arg[2], arg[3], arg[4]); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
130 return 0; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
131 else |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
132 warn("Unknown command: %s", command); |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
133 return 1; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
134 end |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
135 return 0; |
1969310ea06a
mod_roster_command: Manage rosters through prosodyctl
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
136 end |