Annotate

plugins/mod_roster.lua @ 90:da468ed49a7b

Stanza preserialize/deserialize helpers, to strip and restore stanzas respectively. Fixed mod_vcard to use these.
author Matthew Wild <mwild1@gmail.com>
date Thu, 09 Oct 2008 00:50:45 +0100
parent 79:2766e23c4d7d
child 102:a5b914370db5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2 local st = require "util.stanza"
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 local send = require "core.sessionmanager".send_to_session
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 add_iq_handler("c2s", "jabber:iq:roster",
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 function (session, stanza)
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 if stanza.attr.type == "get" then
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 local roster = st.reply(stanza)
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 :query("jabber:iq:roster");
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 for jid in pairs(session.roster) do
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11 roster:tag("item", { jid = jid, subscription = "none" }):up();
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 end
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 send(session, roster);
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 return true;
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 end
bcf539295f2d Huge commit to:
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
16 end);