core/stanza_router.lua

branch
s2s
changeset 127
93f3c6b94c75
parent 122
21f8d2175393
child 138
cb0dd442ca63
child 144
ed78c1a0401e
equal deleted inserted replaced
126:63863534b1f1 127:93f3c6b94c75
91 handle_stanza(session, stanza); 91 handle_stanza(session, stanza);
92 end 92 end
93 end 93 end
94 end 94 end
95 95
96 -- TODO: Does this function belong here?
96 function is_authorized_to_see_presence(origin, username, host) 97 function is_authorized_to_see_presence(origin, username, host)
97 local roster = datamanager.load(username, host, "roster") or {}; 98 local roster = datamanager.load(username, host, "roster") or {};
98 local item = roster[origin.username.."@"..origin.host]; 99 local item = roster[origin.username.."@"..origin.host];
99 return item and (item.subscription == "both" or item.subscription == "from"); 100 return item and (item.subscription == "both" or item.subscription == "from");
100 end 101 end
184 end 185 end
185 end 186 end
186 end 187 end
187 else 188 else
188 -- Remote host 189 -- Remote host
189 if host_session then 190 send_s2s(origin.host, host, stanza);
190 -- Send to session
191 else
192 -- Need to establish the connection
193 end
194 end 191 end
195 stanza.attr.to = to; -- reset 192 stanza.attr.to = to; -- reset
196 end 193 end
197 194
198 function handle_stanza_toremote(stanza) 195 function handle_stanza_toremote(stanza)

mercurial