Software /
code /
prosody
Annotate
plugins/mod_roster.lua @ 2054:a43aea9b0bd1
mod_console: Added proper cleanup for disconnected console sessions.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sun, 25 Oct 2009 21:21:25 +0500 |
parent | 1668:a276d379e00a |
child | 2227:1888368c58c5 |
rev | line source |
---|---|
1523
841d61be198f
Remove version number from copyright headers
Matthew Wild <mwild1@gmail.com>
parents:
1355
diff
changeset
|
1 -- Prosody IM |
760
90ce865eebd8
Update copyright notices for 2009
Matthew Wild <mwild1@gmail.com>
parents:
759
diff
changeset
|
2 -- Copyright (C) 2008-2009 Matthew Wild |
90ce865eebd8
Update copyright notices for 2009
Matthew Wild <mwild1@gmail.com>
parents:
759
diff
changeset
|
3 -- Copyright (C) 2008-2009 Waqas Hussain |
519
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
438
diff
changeset
|
4 -- |
758 | 5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. | |
519
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
438
diff
changeset
|
7 -- |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
438
diff
changeset
|
8 |
cccd610a0ef9
Insert copyright/license headers
Matthew Wild <mwild1@gmail.com>
parents:
438
diff
changeset
|
9 |
30 | 10 |
11 local st = require "util.stanza" | |
12 | |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
13 local jid_split = require "util.jid".split; |
928
92288c13d7bc
Fixed: mod_roster: Prep JIDs being added to roster (part of issue #57)
Waqas Hussain <waqas20@gmail.com>
parents:
916
diff
changeset
|
14 local jid_prep = require "util.jid".prep; |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
15 local t_concat = table.concat; |
916
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
16 local tostring = tostring; |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
17 |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
18 local rm_remove_from_roster = require "core.rostermanager".remove_from_roster; |
110 | 19 local rm_add_to_roster = require "core.rostermanager".add_to_roster; |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
20 local rm_roster_push = require "core.rostermanager".roster_push; |
1354
a27eb60a77cd
mod_roster: Using core_post_stanza in place of core.presencemanager.handle_presence
Waqas Hussain <waqas20@gmail.com>
parents:
1200
diff
changeset
|
21 local core_post_stanza = core_post_stanza; |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
22 |
541
3521e0851c9e
Change modules to use the new add_feature module API method.
Waqas Hussain <waqas20@gmail.com>
parents:
519
diff
changeset
|
23 module:add_feature("jabber:iq:roster"); |
421
63be85693710
Modules now sending disco replies
Waqas Hussain <waqas20@gmail.com>
parents:
326
diff
changeset
|
24 |
1133
b293d7dc6a45
mod_roster: Advertize roster versioning support
Waqas Hussain <waqas20@gmail.com>
parents:
928
diff
changeset
|
25 local rosterver_stream_feature = st.stanza("ver", {xmlns="urn:xmpp:features:rosterver"}):tag("optional"):up(); |
b293d7dc6a45
mod_roster: Advertize roster versioning support
Waqas Hussain <waqas20@gmail.com>
parents:
928
diff
changeset
|
26 module:add_event_hook("stream-features", |
1668
a276d379e00a
Removing tabs at the end of a line.
Tobias Markmann <tm@ayena.de>
parents:
1523
diff
changeset
|
27 function (session, features) |
1133
b293d7dc6a45
mod_roster: Advertize roster versioning support
Waqas Hussain <waqas20@gmail.com>
parents:
928
diff
changeset
|
28 if session.username then |
b293d7dc6a45
mod_roster: Advertize roster versioning support
Waqas Hussain <waqas20@gmail.com>
parents:
928
diff
changeset
|
29 features:add_child(rosterver_stream_feature); |
b293d7dc6a45
mod_roster: Advertize roster versioning support
Waqas Hussain <waqas20@gmail.com>
parents:
928
diff
changeset
|
30 end |
b293d7dc6a45
mod_roster: Advertize roster versioning support
Waqas Hussain <waqas20@gmail.com>
parents:
928
diff
changeset
|
31 end); |
b293d7dc6a45
mod_roster: Advertize roster versioning support
Waqas Hussain <waqas20@gmail.com>
parents:
928
diff
changeset
|
32 |
438
193f9dd64f17
Bumper commit for the new modulemanager API \o/ Updates all the modules, though some more changes may be in store.
Matthew Wild <mwild1@gmail.com>
parents:
421
diff
changeset
|
33 module:add_iq_handler("c2s", "jabber:iq:roster", |
30 | 34 function (session, stanza) |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
35 if stanza.tags[1].name == "query" then |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
36 if stanza.attr.type == "get" then |
1198
545c81364939
mod_roster: Don't send a query element in roster response if roster is unchanged
Matthew Wild <mwild1@gmail.com>
parents:
1133
diff
changeset
|
37 local roster = st.reply(stanza); |
916
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
38 |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
39 local ver = stanza.tags[1].attr.ver |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
40 |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
41 if (not ver) or tonumber(ver) ~= (session.roster[false].version or 1) then |
1198
545c81364939
mod_roster: Don't send a query element in roster response if roster is unchanged
Matthew Wild <mwild1@gmail.com>
parents:
1133
diff
changeset
|
42 roster:query("jabber:iq:roster"); |
916
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
43 -- Client does not support versioning, or has stale roster |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
44 for jid in pairs(session.roster) do |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
45 if jid ~= "pending" and jid then |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
46 roster:tag("item", { |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
47 jid = jid, |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
48 subscription = session.roster[jid].subscription, |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
49 ask = session.roster[jid].ask, |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
50 name = session.roster[jid].name, |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
51 }); |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
52 for group in pairs(session.roster[jid].groups) do |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
53 roster:tag("group"):text(group):up(); |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
54 end |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
55 roster:up(); -- move out from item |
177
606c433955e7
Bug fixes and checks for presence subscriptions, etc
Waqas Hussain <waqas20@gmail.com>
parents:
132
diff
changeset
|
56 end |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
57 end |
916
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
58 roster.tags[1].attr.ver = tostring(session.roster[false].version or "1"); |
102
a5b914370db5
Fixed: mod_roster now outputs all roster data (instead of just the JIDs)
Waqas Hussain <waqas20@gmail.com>
parents:
79
diff
changeset
|
59 end |
299
300b5a201ad3
Fix mod_roster to use session.send for sending stanzas
Matthew Wild <mwild1@gmail.com>
parents:
193
diff
changeset
|
60 session.send(roster); |
114
bed2a8508cf5
Added session property for interested resources
Waqas Hussain <waqas20@gmail.com>
parents:
110
diff
changeset
|
61 session.interested = true; -- resource is interested in roster updates |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
62 return true; |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
63 elseif stanza.attr.type == "set" then |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
64 local query = stanza.tags[1]; |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
65 if #query.tags == 1 and query.tags[1].name == "item" |
916
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
66 and query.tags[1].attr.xmlns == "jabber:iq:roster" and query.tags[1].attr.jid |
f0743928ef7e
core.rostermanager/mod_roster: Support for roster versioning
Matthew Wild <mwild1@gmail.com>
parents:
896
diff
changeset
|
67 -- Protection against overwriting roster.pending, until we move it |
177
606c433955e7
Bug fixes and checks for presence subscriptions, etc
Waqas Hussain <waqas20@gmail.com>
parents:
132
diff
changeset
|
68 and query.tags[1].attr.jid ~= "pending" then |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
69 local item = query.tags[1]; |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
70 local from_node, from_host = jid_split(stanza.attr.from); |
326
99a8317d1235
Send unsubscribe and unsubscribed on roster item delete, and broadcast available resources' presence in reply to pre-approved subscription request
Waqas Hussain <waqas20@gmail.com>
parents:
299
diff
changeset
|
71 local from_bare = from_node and (from_node.."@"..from_host) or from_host; -- bare JID |
928
92288c13d7bc
Fixed: mod_roster: Prep JIDs being added to roster (part of issue #57)
Waqas Hussain <waqas20@gmail.com>
parents:
916
diff
changeset
|
72 local jid = jid_prep(item.attr.jid); |
92288c13d7bc
Fixed: mod_roster: Prep JIDs being added to roster (part of issue #57)
Waqas Hussain <waqas20@gmail.com>
parents:
916
diff
changeset
|
73 local node, host, resource = jid_split(jid); |
326
99a8317d1235
Send unsubscribe and unsubscribed on roster item delete, and broadcast available resources' presence in reply to pre-approved subscription request
Waqas Hussain <waqas20@gmail.com>
parents:
299
diff
changeset
|
74 if not resource and host then |
928
92288c13d7bc
Fixed: mod_roster: Prep JIDs being added to roster (part of issue #57)
Waqas Hussain <waqas20@gmail.com>
parents:
916
diff
changeset
|
75 if jid ~= from_node.."@"..from_host then |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
76 if item.attr.subscription == "remove" then |
928
92288c13d7bc
Fixed: mod_roster: Prep JIDs being added to roster (part of issue #57)
Waqas Hussain <waqas20@gmail.com>
parents:
916
diff
changeset
|
77 local r_item = session.roster[jid]; |
326
99a8317d1235
Send unsubscribe and unsubscribed on roster item delete, and broadcast available resources' presence in reply to pre-approved subscription request
Waqas Hussain <waqas20@gmail.com>
parents:
299
diff
changeset
|
78 if r_item then |
928
92288c13d7bc
Fixed: mod_roster: Prep JIDs being added to roster (part of issue #57)
Waqas Hussain <waqas20@gmail.com>
parents:
916
diff
changeset
|
79 local success, err_type, err_cond, err_msg = rm_remove_from_roster(session, jid); |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
80 if success then |
299
300b5a201ad3
Fix mod_roster to use session.send for sending stanzas
Matthew Wild <mwild1@gmail.com>
parents:
193
diff
changeset
|
81 session.send(st.reply(stanza)); |
928
92288c13d7bc
Fixed: mod_roster: Prep JIDs being added to roster (part of issue #57)
Waqas Hussain <waqas20@gmail.com>
parents:
916
diff
changeset
|
82 rm_roster_push(from_node, from_host, jid); |
92288c13d7bc
Fixed: mod_roster: Prep JIDs being added to roster (part of issue #57)
Waqas Hussain <waqas20@gmail.com>
parents:
916
diff
changeset
|
83 local to_bare = node and (node.."@"..host) or host; -- bare JID |
326
99a8317d1235
Send unsubscribe and unsubscribed on roster item delete, and broadcast available resources' presence in reply to pre-approved subscription request
Waqas Hussain <waqas20@gmail.com>
parents:
299
diff
changeset
|
84 if r_item.subscription == "both" or r_item.subscription == "from" then |
1354
a27eb60a77cd
mod_roster: Using core_post_stanza in place of core.presencemanager.handle_presence
Waqas Hussain <waqas20@gmail.com>
parents:
1200
diff
changeset
|
85 core_post_stanza(session, st.presence({type="unsubscribed", from=session.full_jid, to=to_bare})); |
326
99a8317d1235
Send unsubscribe and unsubscribed on roster item delete, and broadcast available resources' presence in reply to pre-approved subscription request
Waqas Hussain <waqas20@gmail.com>
parents:
299
diff
changeset
|
86 elseif r_item.subscription == "both" or r_item.subscription == "to" then |
1354
a27eb60a77cd
mod_roster: Using core_post_stanza in place of core.presencemanager.handle_presence
Waqas Hussain <waqas20@gmail.com>
parents:
1200
diff
changeset
|
87 core_post_stanza(session, st.presence({type="unsubscribe", from=session.full_jid, to=to_bare})); |
326
99a8317d1235
Send unsubscribe and unsubscribed on roster item delete, and broadcast available resources' presence in reply to pre-approved subscription request
Waqas Hussain <waqas20@gmail.com>
parents:
299
diff
changeset
|
88 end |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
89 else |
299
300b5a201ad3
Fix mod_roster to use session.send for sending stanzas
Matthew Wild <mwild1@gmail.com>
parents:
193
diff
changeset
|
90 session.send(st.error_reply(stanza, err_type, err_cond, err_msg)); |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
91 end |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
92 else |
299
300b5a201ad3
Fix mod_roster to use session.send for sending stanzas
Matthew Wild <mwild1@gmail.com>
parents:
193
diff
changeset
|
93 session.send(st.error_reply(stanza, "modify", "item-not-found")); |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
94 end |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
95 else |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
96 local r_item = {name = item.attr.name, groups = {}}; |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
97 if r_item.name == "" then r_item.name = nil; end |
928
92288c13d7bc
Fixed: mod_roster: Prep JIDs being added to roster (part of issue #57)
Waqas Hussain <waqas20@gmail.com>
parents:
916
diff
changeset
|
98 if session.roster[jid] then |
92288c13d7bc
Fixed: mod_roster: Prep JIDs being added to roster (part of issue #57)
Waqas Hussain <waqas20@gmail.com>
parents:
916
diff
changeset
|
99 r_item.subscription = session.roster[jid].subscription; |
92288c13d7bc
Fixed: mod_roster: Prep JIDs being added to roster (part of issue #57)
Waqas Hussain <waqas20@gmail.com>
parents:
916
diff
changeset
|
100 r_item.ask = session.roster[jid].ask; |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
101 else |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
102 r_item.subscription = "none"; |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
103 end |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
104 for _, child in ipairs(item) do |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
105 if child.name == "group" then |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
106 local text = t_concat(child); |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
107 if text and text ~= "" then |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
108 r_item.groups[text] = true; |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
109 end |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
110 end |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
111 end |
928
92288c13d7bc
Fixed: mod_roster: Prep JIDs being added to roster (part of issue #57)
Waqas Hussain <waqas20@gmail.com>
parents:
916
diff
changeset
|
112 local success, err_type, err_cond, err_msg = rm_add_to_roster(session, jid, r_item); |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
113 if success then |
1200
57a72472e1bc
mod_roster: Add some comments for the error cases to improve readability
Matthew Wild <mwild1@gmail.com>
parents:
1198
diff
changeset
|
114 -- Ok, send success |
299
300b5a201ad3
Fix mod_roster to use session.send for sending stanzas
Matthew Wild <mwild1@gmail.com>
parents:
193
diff
changeset
|
115 session.send(st.reply(stanza)); |
1200
57a72472e1bc
mod_roster: Add some comments for the error cases to improve readability
Matthew Wild <mwild1@gmail.com>
parents:
1198
diff
changeset
|
116 -- and push change to all resources |
928
92288c13d7bc
Fixed: mod_roster: Prep JIDs being added to roster (part of issue #57)
Waqas Hussain <waqas20@gmail.com>
parents:
916
diff
changeset
|
117 rm_roster_push(from_node, from_host, jid); |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
118 else |
1200
57a72472e1bc
mod_roster: Add some comments for the error cases to improve readability
Matthew Wild <mwild1@gmail.com>
parents:
1198
diff
changeset
|
119 -- Adding to roster failed |
299
300b5a201ad3
Fix mod_roster to use session.send for sending stanzas
Matthew Wild <mwild1@gmail.com>
parents:
193
diff
changeset
|
120 session.send(st.error_reply(stanza, err_type, err_cond, err_msg)); |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
121 end |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
122 end |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
123 else |
1200
57a72472e1bc
mod_roster: Add some comments for the error cases to improve readability
Matthew Wild <mwild1@gmail.com>
parents:
1198
diff
changeset
|
124 -- Trying to add self to roster |
299
300b5a201ad3
Fix mod_roster to use session.send for sending stanzas
Matthew Wild <mwild1@gmail.com>
parents:
193
diff
changeset
|
125 session.send(st.error_reply(stanza, "cancel", "not-allowed")); |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
126 end |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
127 else |
1200
57a72472e1bc
mod_roster: Add some comments for the error cases to improve readability
Matthew Wild <mwild1@gmail.com>
parents:
1198
diff
changeset
|
128 -- Invalid JID added to roster |
299
300b5a201ad3
Fix mod_roster to use session.send for sending stanzas
Matthew Wild <mwild1@gmail.com>
parents:
193
diff
changeset
|
129 session.send(st.error_reply(stanza, "modify", "bad-request")); -- FIXME what's the correct error? |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
130 end |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
131 else |
1200
57a72472e1bc
mod_roster: Add some comments for the error cases to improve readability
Matthew Wild <mwild1@gmail.com>
parents:
1198
diff
changeset
|
132 -- Roster set didn't include a single item, or its name wasn't 'item' |
299
300b5a201ad3
Fix mod_roster to use session.send for sending stanzas
Matthew Wild <mwild1@gmail.com>
parents:
193
diff
changeset
|
133 session.send(st.error_reply(stanza, "modify", "bad-request")); |
108
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
134 end |
1d79da482c5d
Added: More complete implementation for mod_roster
Waqas Hussain <waqas20@gmail.com>
parents:
102
diff
changeset
|
135 return true; |
30 | 136 end |
137 end | |
438
193f9dd64f17
Bumper commit for the new modulemanager API \o/ Updates all the modules, though some more changes may be in store.
Matthew Wild <mwild1@gmail.com>
parents:
421
diff
changeset
|
138 end); |