clix/roster.lua

changeset 61
7d62bff46601
parent 59
46cb6e772e31
child 62
f455dad33efd
equal deleted inserted replaced
60:1537dabc5df8 61:7d62bff46601
31 }; 31 };
32 local commands = { 32 local commands = {
33 quit = function(param) conn:close(); end; 33 quit = function(param) conn:close(); end;
34 add = function(param) conn.roster:add_contact(param) end; 34 add = function(param) conn.roster:add_contact(param) end;
35 sub = function(param) conn:send(verse.presence{to=param, type="subscribe"}); end; 35 sub = function(param) conn:send(verse.presence{to=param, type="subscribe"}); end;
36 unsub = function(param) conn:send(verse.presence{to=param, type="unsubscribe"}); end;
36 auth = function(param) conn:send(verse.presence{to=param, type="subscribed"}); end; 37 auth = function(param) conn:send(verse.presence{to=param, type="subscribed"}); end;
38 unauth = function(param) conn:send(verse.presence{to=param, type="unsubscribed"}); end;
37 del = function(param) conn.roster:delete_contact(param) end; 39 del = function(param) conn.roster:delete_contact(param) end;
38 setnick = function(param) 40 setnick = function(param)
39 local jid, nick = param:match("^(%S+)%s+(%S+)"); 41 local jid, nick = param:match("^(%S+)%s+(%S+)");
40 local item = conn.roster.items[jid]; 42 local item = conn.roster.items[jid];
41 if not item then print("no jid "..jid); return; end 43 if not item then print("no jid "..jid); return; end

mercurial