Comparison

tools/jabberd14sql2prosody.lua @ 11681:e270d22b11d9

tools/jabberd14sql2prosody: Tweak wording in comments
author Kim Alvefur <zash@zash.se>
date Tue, 13 Jul 2021 23:28:49 +0200
parent 6149:2ae6e9063e88
child 13142:879a6a33c21b
comparison
equal deleted inserted replaced
11680:a3d3fb9d0d43 11681:e270d22b11d9
466 local ret, err = dm.store(username, host, "vcard", st.preserialize(stanza)); 466 local ret, err = dm.store(username, host, "vcard", st.preserialize(stanza));
467 print("["..(err or "success").."] stored vCard: "..username.."@"..host); 467 print("["..(err or "success").."] stored vCard: "..username.."@"..host);
468 end 468 end
469 469
470 function store_roster(username, host, roster_items) 470 function store_roster(username, host, roster_items)
471 -- fetch current roster-table for username@host if he already has one 471 -- fetch current roster-table for username@host if they already have one
472 local roster = dm.load(username, host, "roster") or {}; 472 local roster = dm.load(username, host, "roster") or {};
473 -- merge imported roster-items with loaded roster 473 -- merge imported roster-items with loaded roster
474 for item_tag in roster_items:childtags() do 474 for item_tag in roster_items:childtags() do
475 -- jid for this roster-item 475 -- jid for this roster-item
476 local item_jid = item_tag.attr.jid 476 local item_jid = item_tag.attr.jid
506 end 506 end
507 507
508 function store_subscription_request(username, host, presence_stanza) 508 function store_subscription_request(username, host, presence_stanza)
509 local from_bare = presence_stanza.attr.from; 509 local from_bare = presence_stanza.attr.from;
510 510
511 -- fetch current roster-table for username@host if he already has one 511 -- fetch current roster-table for username@host if they already have one
512 local roster = dm.load(username, host, "roster") or {}; 512 local roster = dm.load(username, host, "roster") or {};
513 513
514 local item = roster[from_bare]; 514 local item = roster[from_bare];
515 if item and (item.subscription == "from" or item.subscription == "both") then 515 if item and (item.subscription == "from" or item.subscription == "both") then
516 return; -- already subscribed, do nothing 516 return; -- already subscribed, do nothing