Annotate

plugins/roster.lua @ 82:f306c2f8bb88

plugins.roster: Unfinished roster plugin
author Matthew Wild <mwild1@gmail.com>
date Fri, 02 Jul 2010 13:36:18 +0100
child 192:d20feb8034f5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
82
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
1 local xmlns_roster = "jabber:iq:roster";
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 function verse.plugins.roster(stream)
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 function stream:roster_add(jid, callback)
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 self:send_iq(verse.iq({ type = "set" })
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 :tag("query", { xmlns = xmlns_roster })
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
7 :tag("item", { jid = jid }), function ()
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
8 callback();
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
9 end);
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
10 end
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
11
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
12 function stream:roster_fetch(callback)
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
13 self:send_iq(verse.iq({type="get"}):tag("query", { xmlns = xmlns_roster }),
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
14 function (result)
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
15 --TODO: Pass parsed roster to callback
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
16 callback(result);
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
17 end);
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
18 end
f306c2f8bb88 plugins.roster: Unfinished roster plugin
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
19 end