Comparison

plugins/mod_vcard.lua @ 438:193f9dd64f17

Bumper commit for the new modulemanager API \o/ Updates all the modules, though some more changes may be in store.
author Matthew Wild <mwild1@gmail.com>
date Thu, 27 Nov 2008 03:12:12 +0000
parent 421:63be85693710
child 519:cccd610a0ef9
comparison
equal deleted inserted replaced
437:c1a720db2157 438:193f9dd64f17
8 require "util.jid" 8 require "util.jid"
9 local jid_split = jid.split; 9 local jid_split = jid.split;
10 10
11 require "core.discomanager".set("vcard", "vcard-temp"); 11 require "core.discomanager".set("vcard", "vcard-temp");
12 12
13 add_iq_handler({"c2s", "s2sin"}, "vcard-temp", 13 module:add_iq_handler({"c2s", "s2sin"}, "vcard-temp",
14 function (session, stanza) 14 function (session, stanza)
15 if stanza.tags[1].name == "vCard" then 15 if stanza.tags[1].name == "vCard" then
16 local to = stanza.attr.to; 16 local to = stanza.attr.to;
17 if stanza.attr.type == "get" then 17 if stanza.attr.type == "get" then
18 local vCard; 18 local vCard;
44 return true; 44 return true;
45 end 45 end
46 end); 46 end);
47 47
48 local feature_vcard_attr = { var='vcard-temp' }; 48 local feature_vcard_attr = { var='vcard-temp' };
49 add_event_hook("stream-features", 49 module:add_event_hook("stream-features",
50 function (session, features) 50 function (session, features)
51 if session.type == "c2s" then 51 if session.type == "c2s" then
52 features:tag("feature", feature_vcard_attr):up(); 52 features:tag("feature", feature_vcard_attr):up();
53 end 53 end
54 end); 54 end);