Software /
code /
prosody-modules
Annotate
mod_ircd/mod_ircd.in.lua @ 495:1a71e0e21a29
mod_ircd: added USERHOST placeholder.
author | Marco Cirillo <maranda@lightwitch.org> |
---|---|
date | Mon, 05 Dec 2011 04:08:11 +0000 |
parent | 491:5b3db688213d |
child | 496:ceeb8b3056de |
rev | line source |
---|---|
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
1 -- README |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
2 -- Squish verse into this dir, then squish them into one, which you move |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
3 -- and rename to mod_ircd.lua in your prosody modules/plugins dir. |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
4 -- |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
5 -- IRC spec: |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
6 -- http://tools.ietf.org/html/rfc2812 |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
7 |
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
8 local _module = module |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
9 module = _G.module |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
10 local module = _module |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
11 local client_xmlns = "jabber:client" |
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
12 |
483
f4ada087c743
mod_ircd: added listener port configuration, added utf8 checks to TOPIC, added check so that module wonn't get loaded if conference_server is unset.
Marco Cirillo <maranda@lightwitch.org>
parents:
482
diff
changeset
|
13 local component_jid, component_secret, muc_server, port_number = |
f4ada087c743
mod_ircd: added listener port configuration, added utf8 checks to TOPIC, added check so that module wonn't get loaded if conference_server is unset.
Marco Cirillo <maranda@lightwitch.org>
parents:
482
diff
changeset
|
14 module.host, nil, module:get_option_string("conference_server"), module:get_option_number("listener_port", 7000); |
f4ada087c743
mod_ircd: added listener port configuration, added utf8 checks to TOPIC, added check so that module wonn't get loaded if conference_server is unset.
Marco Cirillo <maranda@lightwitch.org>
parents:
482
diff
changeset
|
15 |
f4ada087c743
mod_ircd: added listener port configuration, added utf8 checks to TOPIC, added check so that module wonn't get loaded if conference_server is unset.
Marco Cirillo <maranda@lightwitch.org>
parents:
482
diff
changeset
|
16 if not muc_server then |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
17 module:log ("error", "You need to set the MUC server! halting.") |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
18 return false; |
483
f4ada087c743
mod_ircd: added listener port configuration, added utf8 checks to TOPIC, added check so that module wonn't get loaded if conference_server is unset.
Marco Cirillo <maranda@lightwitch.org>
parents:
482
diff
changeset
|
19 end |
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
20 |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
21 package.loaded["util.sha1"] = require "util.encodings"; |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
22 local verse = require "verse" |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
23 require "verse.component" |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
24 require "socket" |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
25 c = verse.new(); |
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
26 c:add_plugin("groupchat"); |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
27 |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
28 local function verse2prosody(e) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
29 return c:event("stanza", e.stanza) or true; |
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
30 end |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
31 module:hook("message/bare", verse2prosody); |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
32 module:hook("message/full", verse2prosody); |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
33 module:hook("presence/bare", verse2prosody); |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
34 module:hook("presence/full", verse2prosody); |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
35 c.type = "component"; |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
36 c.send = core_post_stanza; |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
37 |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
38 local jid = require "util.jid"; |
466
0fcd34ee7301
mod_ircd: Proper line parsing and generating. Fix PMs
Kim Alvefur <zash@zash.se>
parents:
465
diff
changeset
|
39 local nodeprep = require "util.encodings".stringprep.nodeprep; |
0fcd34ee7301
mod_ircd: Proper line parsing and generating. Fix PMs
Kim Alvefur <zash@zash.se>
parents:
465
diff
changeset
|
40 |
468
640e6c0b563d
mod_ircd: Scrub invalid UTF-8 sequences, welcome message
Kim Alvefur <zash@zash.se>
parents:
466
diff
changeset
|
41 local function utf8_clean (s) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
42 local push, join = table.insert, table.concat; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
43 local r, i = {}, 1; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
44 if not(s and #s > 0) then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
45 return "" |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
46 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
47 while true do |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
48 local c = s:sub(i,i) |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
49 local b = c:byte(); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
50 local w = ( |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
51 (b >= 9 and b <= 10 and 0) or |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
52 (b >= 32 and b <= 126 and 0) or |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
53 (b >= 192 and b <= 223 and 1) or |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
54 (b >= 224 and b <= 239 and 2) or |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
55 (b >= 240 and b <= 247 and 3) or |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
56 (b >= 248 and b <= 251 and 4) or |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
57 (b >= 251 and b <= 252 and 5) or nil |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
58 ) |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
59 if not w then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
60 push(r, "?") |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
61 else |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
62 local n = i + w; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
63 if w == 0 then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
64 push(r, c); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
65 elseif n > #s then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
66 push(r, ("?"):format(b)); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
67 else |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
68 local e = s:sub(i+1,n); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
69 if e:match('^[\128-\191]*$') then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
70 push(r, c); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
71 push(r, e); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
72 i = n; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
73 else |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
74 push(r, ("?"):format(b)); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
75 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
76 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
77 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
78 i = i + 1; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
79 if i > #s then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
80 break |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
81 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
82 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
83 return join(r); |
468
640e6c0b563d
mod_ircd: Scrub invalid UTF-8 sequences, welcome message
Kim Alvefur <zash@zash.se>
parents:
466
diff
changeset
|
84 end |
640e6c0b563d
mod_ircd: Scrub invalid UTF-8 sequences, welcome message
Kim Alvefur <zash@zash.se>
parents:
466
diff
changeset
|
85 |
466
0fcd34ee7301
mod_ircd: Proper line parsing and generating. Fix PMs
Kim Alvefur <zash@zash.se>
parents:
465
diff
changeset
|
86 local function parse_line(line) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
87 local ret = {}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
88 if line:sub(1,1) == ":" then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
89 ret.from, line = line:match("^:(%w+)%s+(.*)$"); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
90 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
91 for part in line:gmatch("%S+") do |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
92 if part:sub(1,1) == ":" then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
93 ret[#ret+1] = line:match(":(.*)$"); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
94 break |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
95 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
96 ret[#ret+1]=part; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
97 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
98 return ret; |
466
0fcd34ee7301
mod_ircd: Proper line parsing and generating. Fix PMs
Kim Alvefur <zash@zash.se>
parents:
465
diff
changeset
|
99 end |
0fcd34ee7301
mod_ircd: Proper line parsing and generating. Fix PMs
Kim Alvefur <zash@zash.se>
parents:
465
diff
changeset
|
100 |
0fcd34ee7301
mod_ircd: Proper line parsing and generating. Fix PMs
Kim Alvefur <zash@zash.se>
parents:
465
diff
changeset
|
101 local function build_line(parts) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
102 if #parts > 1 then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
103 parts[#parts] = ":" .. parts[#parts]; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
104 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
105 return (parts.from and ":"..parts.from.." " or "")..table.concat(parts, " "); |
466
0fcd34ee7301
mod_ircd: Proper line parsing and generating. Fix PMs
Kim Alvefur <zash@zash.se>
parents:
465
diff
changeset
|
106 end |
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
107 |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
108 local function irc2muc(channel, nick) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
109 local room = channel and nodeprep(channel:match("^#(%w+)")) or nil; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
110 if not nick then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
111 return jid.join(room, muc_server); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
112 else |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
113 return jid.join(room, muc_server, nick); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
114 end |
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
115 end |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
116 local function muc2irc(room) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
117 local channel, _, nick = jid.split(room); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
118 return "#"..channel, nick; |
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
119 end |
470
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
120 local role_map = { |
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
121 moderator = "@", |
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
122 participant = "", |
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
123 visitor = "", |
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
124 none = "" |
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
125 } |
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
126 local aff_map = { |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
127 owner = "~", |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
128 administrator = "&", |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
129 member = "+", |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
130 none = "" |
335
8b81257c9dc5
mod_ircd: Don't allow any command until nick has been set. Split out NAMES into a command.
Kim Alvefur <zash@zash.se>
parents:
329
diff
changeset
|
131 } |
470
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
132 local role_modemap = { |
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
133 moderator = "o", |
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
134 participant = "", |
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
135 visitor = "", |
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
136 none = "" |
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
137 } |
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
138 local aff_modemap = { |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
139 owner = "q", |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
140 administrator = "a", |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
141 member = "v", |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
142 none = "" |
335
8b81257c9dc5
mod_ircd: Don't allow any command until nick has been set. Split out NAMES into a command.
Kim Alvefur <zash@zash.se>
parents:
329
diff
changeset
|
143 } |
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
144 |
483
f4ada087c743
mod_ircd: added listener port configuration, added utf8 checks to TOPIC, added check so that module wonn't get loaded if conference_server is unset.
Marco Cirillo <maranda@lightwitch.org>
parents:
482
diff
changeset
|
145 local irc_listener = { default_port = port_number, default_mode = "*l" }; |
111
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
146 |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
147 local sessions = {}; |
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
148 local jids = {}; |
111
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
149 local commands = {}; |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
150 |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
151 local nicks = {}; |
488
4885ca74515c
mod_ircd: corrected an issue within the nick change logic, and improved it by implementing the USER command.
Marco Cirillo <maranda@lightwitch.org>
parents:
487
diff
changeset
|
152 local usernames = {}; |
111
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
153 |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
154 local st = require "util.stanza"; |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
155 |
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
156 local conference_server = muc_server; |
111
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
157 |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
158 local function irc_close_session(session) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
159 session.conn:close(); |
111
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
160 end |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
161 |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
162 function irc_listener.onincoming(conn, data) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
163 local session = sessions[conn]; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
164 if not session then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
165 session = { conn = conn, host = component_jid, reset_stream = function () end, |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
166 close = irc_close_session, log = logger.init("irc"..(conn.id or "1")), |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
167 rooms = {}, roster = {}, has_un = false }; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
168 sessions[conn] = session; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
169 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
170 function session.data(data) |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
171 local parts = parse_line(data); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
172 module:log("debug", require"util.serialization".serialize(parts)); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
173 local command = table.remove(parts, 1); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
174 if not command then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
175 return; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
176 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
177 command = command:upper(); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
178 if not session.username and not session.nick then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
179 if not (command == "USER" or command == "NICK") then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
180 module:log("debug", "Client tried to send command %s before registering", command); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
181 return session.send{from=muc_server, "451", command, "You have not completed the registration."} |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
182 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
183 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
184 if commands[command] then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
185 local ret = commands[command](session, parts); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
186 if ret then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
187 return session.send(ret); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
188 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
189 else |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
190 session.send{from=muc_server, "421", session.nick, command, "Unknown command"}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
191 return module:log("debug", "Unknown command: %s", command); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
192 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
193 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
194 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
195 function session.send(data) |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
196 if type(data) == "string" then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
197 return conn:write(data.."\r\n"); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
198 elseif type(data) == "table" then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
199 local line = build_line(data); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
200 module:log("debug", line); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
201 conn:write(line.."\r\n"); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
202 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
203 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
204 end |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
205 |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
206 if data then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
207 session.data(data); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
208 end |
111
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
209 end |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
210 |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
211 function irc_listener.ondisconnect(conn, error) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
212 local session = sessions[conn]; |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
213 |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
214 if session then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
215 for _, room in pairs(session.rooms) do |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
216 room:leave("Disconnected"); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
217 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
218 if session.nick then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
219 nicks[session.nick] = nil; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
220 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
221 if session.full_jid then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
222 jids[session.full_jid] = nil; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
223 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
224 if session.username then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
225 usernames[session.username] = nil; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
226 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
227 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
228 sessions[conn] = nil; |
111
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
229 end |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
230 |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
231 local function nick_inuse(nick) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
232 if nicks[nick] then return true else return false end |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
233 end |
488
4885ca74515c
mod_ircd: corrected an issue within the nick change logic, and improved it by implementing the USER command.
Marco Cirillo <maranda@lightwitch.org>
parents:
487
diff
changeset
|
234 local function check_username(un) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
235 local count = 0; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
236 local result; |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
237 |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
238 for name, given in pairs(usernames) do |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
239 if un == given then count = count + 1; end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
240 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
241 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
242 result = count + 1; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
243 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
244 if count > 0 then return tostring(un)..tostring(result); else return tostring(un); end |
488
4885ca74515c
mod_ircd: corrected an issue within the nick change logic, and improved it by implementing the USER command.
Marco Cirillo <maranda@lightwitch.org>
parents:
487
diff
changeset
|
245 end |
4885ca74515c
mod_ircd: corrected an issue within the nick change logic, and improved it by implementing the USER command.
Marco Cirillo <maranda@lightwitch.org>
parents:
487
diff
changeset
|
246 local function set_t_data(session, full_jid) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
247 session.full_jid = full_jid; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
248 jids[full_jid] = session; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
249 jids[full_jid]["ar_last"] = {}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
250 jids[full_jid]["nicks_changing"] = {}; |
488
4885ca74515c
mod_ircd: corrected an issue within the nick change logic, and improved it by implementing the USER command.
Marco Cirillo <maranda@lightwitch.org>
parents:
487
diff
changeset
|
251 |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
252 if session.nick then nicks[session.nick] = session; end |
488
4885ca74515c
mod_ircd: corrected an issue within the nick change logic, and improved it by implementing the USER command.
Marco Cirillo <maranda@lightwitch.org>
parents:
487
diff
changeset
|
253 end |
4885ca74515c
mod_ircd: corrected an issue within the nick change logic, and improved it by implementing the USER command.
Marco Cirillo <maranda@lightwitch.org>
parents:
487
diff
changeset
|
254 local function send_motd(session) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
255 local nick = session.nick; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
256 session.send{from = muc_server, "001", nick, "Welcome in the IRC to MUC XMPP Gateway, "..nick}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
257 session.send{from = muc_server, "002", nick, "Your host is "..muc_server.." running Prosody "..prosody.version}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
258 session.send{from = muc_server, "003", nick, "This server was created the "..os.date(nil, prosody.start_time)} |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
259 session.send{from = muc_server, "004", nick, table.concat({muc_server, "mod_ircd(alpha-0.8)", "i", "aoqv"}, " ")}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
260 session.send{from = muc_server, "375", nick, "- "..muc_server.." Message of the day -"}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
261 session.send{from = muc_server, "372", nick, "-"}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
262 session.send{from = muc_server, "372", nick, "- Please be warned that this is only a partial irc implementation,"}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
263 session.send{from = muc_server, "372", nick, "- it's made to facilitate users transiting away from irc to XMPP."}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
264 session.send{from = muc_server, "372", nick, "-"}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
265 session.send{from = muc_server, "372", nick, "- Prosody is _NOT_ an IRC Server and it never will."}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
266 session.send{from = muc_server, "372", nick, "- We also would like to remind you that this plugin is provided as is,"}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
267 session.send{from = muc_server, "372", nick, "- it's still an Alpha and it's still a work in progress, use it at your sole"}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
268 session.send{from = muc_server, "372", nick, "- risk as there's a not so little chance something will break."}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
269 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
270 session.send{from = nick, "MODE", nick, "+i"}; -- why -> Invisible mode setting, |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
271 -- enforce by default on most servers (since the source host doesn't show it's sensible to have it "set") |
111
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
272 end |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
273 |
488
4885ca74515c
mod_ircd: corrected an issue within the nick change logic, and improved it by implementing the USER command.
Marco Cirillo <maranda@lightwitch.org>
parents:
487
diff
changeset
|
274 function commands.NICK(session, args) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
275 local nick = args[1]; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
276 nick = nick:gsub("[^%w_]",""); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
277 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
278 if session.nick and not nick_inuse(nick) then -- changing nick |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
279 local oldnick = session.nick; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
280 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
281 -- update and replace session data |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
282 session.nick = nick; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
283 nicks[oldnick] = nil; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
284 nicks[nick] = session; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
285 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
286 session.send{from=oldnick.."!"..nicks[nick].username, "NICK", nick}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
287 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
288 -- broadcast changes if required |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
289 if session.rooms then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
290 session.nicks_changing[nick] = { oldnick, session.username }; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
291 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
292 for id, room in pairs(session.rooms) do room:change_nick(nick); end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
293 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
294 session.nicks_changing[nick] = nil; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
295 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
296 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
297 return; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
298 elseif nick_inuse(nick) then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
299 session.send{from=muc_server, "433", nick, "The nickname "..nick.." is already in use"}; return; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
300 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
301 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
302 session.nick = nick; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
303 session.type = "c2s"; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
304 nicks[nick] = session; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
305 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
306 -- Some choppy clients send in NICK before USER, that needs to be handled |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
307 if session.username then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
308 set_t_data(session, jid.join(session.username, component_jid, "ircd")); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
309 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
310 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
311 if session.username and session.nick then -- send MOTD |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
312 send_motd(session); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
313 end |
488
4885ca74515c
mod_ircd: corrected an issue within the nick change logic, and improved it by implementing the USER command.
Marco Cirillo <maranda@lightwitch.org>
parents:
487
diff
changeset
|
314 end |
4885ca74515c
mod_ircd: corrected an issue within the nick change logic, and improved it by implementing the USER command.
Marco Cirillo <maranda@lightwitch.org>
parents:
487
diff
changeset
|
315 |
4885ca74515c
mod_ircd: corrected an issue within the nick change logic, and improved it by implementing the USER command.
Marco Cirillo <maranda@lightwitch.org>
parents:
487
diff
changeset
|
316 function commands.USER(session, params) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
317 local username = params[1]; |
488
4885ca74515c
mod_ircd: corrected an issue within the nick change logic, and improved it by implementing the USER command.
Marco Cirillo <maranda@lightwitch.org>
parents:
487
diff
changeset
|
318 |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
319 if not session.has_un then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
320 local un_checked = check_username(username); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
321 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
322 usernames[un_checked] = username; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
323 session.username = un_checked; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
324 session.has_un = true; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
325 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
326 if not session.full_jid then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
327 set_t_data(session, jid.join(session.username, component_jid, "ircd")); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
328 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
329 else |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
330 return session.send{from=muc_server, "462", "USER", "You may not re-register."} |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
331 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
332 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
333 if session.username and session.nick then -- send MOTD |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
334 send_motd(session); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
335 end |
329 | 336 end |
337 | |
495
1a71e0e21a29
mod_ircd: added USERHOST placeholder.
Marco Cirillo <maranda@lightwitch.org>
parents:
491
diff
changeset
|
338 function commands.USERHOST(session, params) -- Empty for now |
1a71e0e21a29
mod_ircd: added USERHOST placeholder.
Marco Cirillo <maranda@lightwitch.org>
parents:
491
diff
changeset
|
339 end |
1a71e0e21a29
mod_ircd: added USERHOST placeholder.
Marco Cirillo <maranda@lightwitch.org>
parents:
491
diff
changeset
|
340 |
470
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
341 local function mode_map(am, rm, nicks) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
342 local rnick; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
343 local c_modes; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
344 c_modes = aff_modemap[am]..role_modemap[rm] |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
345 rnick = string.rep(nicks.." ", c_modes:len()) |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
346 if c_modes == "" then return nil, nil end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
347 return c_modes, rnick |
470
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
348 end |
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
349 |
466
0fcd34ee7301
mod_ircd: Proper line parsing and generating. Fix PMs
Kim Alvefur <zash@zash.se>
parents:
465
diff
changeset
|
350 function commands.JOIN(session, args) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
351 local channel = args[1]; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
352 if not channel then return end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
353 local room_jid = irc2muc(channel); |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
354 |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
355 if not jids[session.full_jid].ar_last[room_jid] then jids[session.full_jid].ar_last[room_jid] = {}; end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
356 local room, err = c:join_room(room_jid, session.nick, { source = session.full_jid } ); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
357 if not room then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
358 return ":"..muc_server.." ERR :Could not join room: "..err |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
359 end |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
360 |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
361 session.rooms[channel] = room; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
362 room.session = session; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
363 |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
364 if session.nicks_changing[session.nick] then -- my own nick is changing |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
365 commands.NAMES(session, channel); |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
366 else |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
367 session.send{from=session.nick.."!"..session.username, "JOIN", channel}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
368 if room.subject then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
369 session.send{from=muc_server, 332, session.nick, channel, room.subject}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
370 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
371 commands.NAMES(session, channel); |
470
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
372 end |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
373 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
374 room:hook("subject-changed", function(changed) |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
375 session.send((":%s TOPIC %s :%s"):format(changed.by.nick, channel, changed.to or "")); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
376 end); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
377 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
378 room:hook("message", function(event) |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
379 if not event.body then return end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
380 local nick, body = event.nick, event.body; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
381 if nick ~= session.nick then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
382 if body:sub(1,4) == "/me " then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
383 body = "\1ACTION ".. body:sub(5) .. "\1" |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
384 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
385 local type = event.stanza.attr.type; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
386 session.send{from=nick, "PRIVMSG", type == "groupchat" and channel or nick, body}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
387 --FIXME PM's probably won't work |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
388 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
389 end); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
390 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
391 room:hook("presence", function(ar) |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
392 local c_modes; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
393 local rnick; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
394 if ar.nick and not jids[session.full_jid].ar_last[ar.room_jid][ar.nick] then jids[session.full_jid].ar_last[ar.room_jid][ar.nick] = {} end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
395 local x_ar = ar.stanza:get_child("x", "http://jabber.org/protocol/muc#user") |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
396 if x_ar then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
397 local xar_item = x_ar:get_child("item") |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
398 if xar_item and xar_item.attr and ar.stanza.attr.type ~= "unavailable" then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
399 if xar_item.attr.affiliation and xar_item.attr.role then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
400 if not jids[session.full_jid].ar_last[ar.room_jid][ar.nick]["affiliation"] and |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
401 not jids[session.full_jid].ar_last[ar.room_jid][ar.nick]["role"] then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
402 jids[session.full_jid].ar_last[ar.room_jid][ar.nick]["affiliation"] = xar_item.attr.affiliation |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
403 jids[session.full_jid].ar_last[ar.room_jid][ar.nick]["role"] = xar_item.attr.role |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
404 n_self_changing = nicks[ar.nick] and nicks[ar.nick].nicks_changing and nicks[ar.nick].nicks_changing[ar.nick] |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
405 if n_self_changing then return; end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
406 c_modes, rnick = mode_map(xar_item.attr.affiliation, xar_item.attr.role, ar.nick); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
407 if c_modes and rnick then session.send((":%s MODE %s +%s"):format(muc_server, channel, c_modes.." "..rnick)); end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
408 else |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
409 c_modes, rnick = mode_map(jids[session.full_jid].ar_last[ar.room_jid][ar.nick]["affiliation"], jids[session.full_jid].ar_last[ar.room_jid][ar.nick]["role"], ar.nick); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
410 if c_modes and rnick then session.send((":%s MODE %s -%s"):format(muc_server, channel, c_modes.." "..rnick)); end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
411 jids[session.full_jid].ar_last[ar.room_jid][ar.nick]["affiliation"] = xar_item.attr.affiliation |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
412 jids[session.full_jid].ar_last[ar.room_jid][ar.nick]["role"] = xar_item.attr.role |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
413 n_self_changing = nicks[ar.nick] and nicks[ar.nick].nicks_changing and nicks[ar.nick].nicks_changing[ar.nick] |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
414 if n_self_changing then return; end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
415 c_modes, rnick = mode_map(xar_item.attr.affiliation, xar_item.attr.role, ar.nick); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
416 if c_modes and rnick then session.send((":%s MODE %s +%s"):format(muc_server, channel, c_modes.." "..rnick)); end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
417 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
418 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
419 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
420 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
421 end, -1); |
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
422 end |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
423 |
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
424 c:hook("groupchat/joined", function(room) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
425 local session = room.session or jids[room.opts.source]; |
470
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
426 local channel = "#"..room.jid:match("^(.*)@"); |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
427 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
428 room:hook("occupant-joined", function(nick) |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
429 if session.nicks_changing[nick.nick] then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
430 session.send{from=session.nicks_changing[nick.nick][1].."!"..(session.nicks_changing[nick.nick][2] or "xmpp"), "NICK", nick.nick}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
431 session.nicks_changing[nick.nick] = nil; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
432 else |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
433 session.send{from=nick.nick.."!"..(nicks[nick.nick] and nicks[nick.nick].username or "xmpp"), "JOIN", channel}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
434 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
435 end); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
436 room:hook("occupant-left", function(nick) |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
437 if jids[session.full_jid] then jids[session.full_jid].ar_last[nick.jid:match("^(.*)/")][nick.nick] = nil; end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
438 local status_code = |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
439 nick.presence:get_child("x","http://jabber.org/protocol/muc#user") and |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
440 nick.presence:get_child("x","http://jabber.org/protocol/muc#user"):get_child("status") and |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
441 nick.presence:get_child("x","http://jabber.org/protocol/muc#user"):get_child("status").attr.code; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
442 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
443 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
444 if status_code == "303" then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
445 local newnick = |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
446 nick.presence:get_child("x","http://jabber.org/protocol/muc#user") and |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
447 nick.presence:get_child("x","http://jabber.org/protocol/muc#user"):get_child("item") and |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
448 nick.presence:get_child("x","http://jabber.org/protocol/muc#user"):get_child("item").attr.nick; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
449 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
450 session.nicks_changing[newnick] = { nick.nick, (nicks[nick.nick] and nicks[nick.nick].username or "xmpp") }; return; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
451 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
452 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
453 for id, data in pairs(session.nicks_changing) do |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
454 if data[1] == nick.nick then return; end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
455 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
456 session.send{from=nick.nick.."!"..(nicks[nick.nick] and nicks[nick.nick].username or "xmpp"), "PART", channel}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
457 end); |
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
458 end); |
111
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
459 |
335
8b81257c9dc5
mod_ircd: Don't allow any command until nick has been set. Split out NAMES into a command.
Kim Alvefur <zash@zash.se>
parents:
329
diff
changeset
|
460 function commands.NAMES(session, channel) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
461 local nicks = { }; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
462 if type(channel) == "table" then channel = channel[1] end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
463 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
464 local room = session.rooms[channel]; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
465 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
466 local symbols_map = { |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
467 owner = "~", |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
468 administrator = "&", |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
469 moderator = "@", |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
470 member = "+" |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
471 } |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
472 |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
473 if not room then return end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
474 -- TODO Break this out into commands.NAMES |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
475 for nick, n in pairs(room.occupants) do |
470
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
476 if n.affiliation == "owner" and n.role == "moderator" then |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
477 nick = symbols_map[n.affiliation]..nick; |
470
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
478 elseif n.affiliation == "administrator" and n.role == "moderator" then |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
479 nick = symbols_map[n.affiliation]..nick; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
480 elseif n.affiliation == "member" and n.role == "moderator" then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
481 nick = symbols_map[n.role]..nick; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
482 elseif n.affiliation == "member" and n.role == "partecipant" then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
483 nick = symbols_map[n.affiliation]..nick; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
484 elseif n.affiliation == "none" and n.role == "moderator" then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
485 nick = symbols_map[n.role]..nick; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
486 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
487 table.insert(nicks, nick); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
488 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
489 nicks = table.concat(nicks, " "); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
490 session.send((":%s 353 %s = %s :%s"):format(muc_server, session.nick, channel, nicks)); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
491 session.send((":%s 366 %s %s :End of /NAMES list."):format(muc_server, session.nick, channel)); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
492 session.send(":"..muc_server.." 353 "..session.nick.." = "..channel.." :"..nicks); |
335
8b81257c9dc5
mod_ircd: Don't allow any command until nick has been set. Split out NAMES into a command.
Kim Alvefur <zash@zash.se>
parents:
329
diff
changeset
|
493 end |
8b81257c9dc5
mod_ircd: Don't allow any command until nick has been set. Split out NAMES into a command.
Kim Alvefur <zash@zash.se>
parents:
329
diff
changeset
|
494 |
466
0fcd34ee7301
mod_ircd: Proper line parsing and generating. Fix PMs
Kim Alvefur <zash@zash.se>
parents:
465
diff
changeset
|
495 function commands.PART(session, args) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
496 local channel, part_message = unpack(args); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
497 local room = channel and nodeprep(channel:match("^#(%w+)")) or nil; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
498 if not room then return end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
499 channel = channel:match("^([%S]*)"); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
500 session.rooms[channel]:leave(part_message); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
501 jids[session.full_jid].ar_last[room.."@"..muc_server] = nil; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
502 session.send(":"..session.nick.." PART :"..channel); |
111
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
503 end |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
504 |
466
0fcd34ee7301
mod_ircd: Proper line parsing and generating. Fix PMs
Kim Alvefur <zash@zash.se>
parents:
465
diff
changeset
|
505 function commands.PRIVMSG(session, args) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
506 local channel, message = unpack(args); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
507 if message and #message > 0 then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
508 if message:sub(1,8) == "\1ACTION " then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
509 message = "/me ".. message:sub(9,-2) |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
510 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
511 message = utf8_clean(message); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
512 if channel:sub(1,1) == "#" then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
513 if session.rooms[channel] then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
514 module:log("debug", "%s sending PRIVMSG \"%s\" to %s", session.nick, message, channel); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
515 session.rooms[channel]:send_message(message); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
516 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
517 else -- private message |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
518 local nick = channel; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
519 module:log("debug", "PM to %s", nick); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
520 for channel, room in pairs(session.rooms) do |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
521 module:log("debug", "looking for %s in %s", nick, channel); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
522 if room.occupants[nick] then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
523 module:log("debug", "found %s in %s", nick, channel); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
524 local who = room.occupants[nick]; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
525 -- FIXME PMs in verse |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
526 --room:send_private_message(nick, message); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
527 local pm = st.message({type="chat",to=who.jid}, message); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
528 module:log("debug", "sending PM to %s: %s", nick, tostring(pm)); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
529 room:send(pm) |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
530 break |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
531 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
532 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
533 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
534 end |
111
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
535 end |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
536 |
466
0fcd34ee7301
mod_ircd: Proper line parsing and generating. Fix PMs
Kim Alvefur <zash@zash.se>
parents:
465
diff
changeset
|
537 function commands.PING(session, args) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
538 session.send{from=muc_server, "PONG", args[1]}; |
132
d4ff1cd414e5
mod_ircd: Add PING command / Echo PART back
Florian Zeitz <florob@babelmonkeys.de>
parents:
111
diff
changeset
|
539 end |
d4ff1cd414e5
mod_ircd: Add PING command / Echo PART back
Florian Zeitz <florob@babelmonkeys.de>
parents:
111
diff
changeset
|
540 |
470
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
541 function commands.TOPIC(session, message) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
542 if not message then return end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
543 local channel, topic = message[1], message[2]; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
544 channel = utf8_clean(channel); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
545 topic = utf8_clean(topic); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
546 if not channel then return end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
547 local room = session.rooms[channel]; |
482
9d62586e7aae
mod_ircd: hacked around it to make it "work" again, topics should be operational once again.
Marco Cirillo <maranda@lightwitch.org>
parents:
473
diff
changeset
|
548 |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
549 if topic then room:set_subject(topic); end |
470
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
550 end |
4f9224369e69
mod_ircd: merged in various changes including -- code to propagate aff/role changes as modes, topic hooks/command, scarecrow motd banner, default port.
Marco Cirillo <maranda@lightwitch.org>
parents:
469
diff
changeset
|
551 |
466
0fcd34ee7301
mod_ircd: Proper line parsing and generating. Fix PMs
Kim Alvefur <zash@zash.se>
parents:
465
diff
changeset
|
552 function commands.WHO(session, args) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
553 local channel = args[1]; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
554 if session.rooms[channel] then |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
555 local room = session.rooms[channel] |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
556 for nick in pairs(room.occupants) do |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
557 session.send{from=muc_server, 352, session.nick, channel, nick, nick, muc_server, nick, "H", "0 "..nick} |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
558 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
559 session.send{from=muc_server, 315, session.nick, channel, "End of /WHO list"}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
560 end |
111
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
561 end |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
562 |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
563 function commands.MODE(session, args) -- Empty command |
111
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
564 end |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
565 |
466
0fcd34ee7301
mod_ircd: Proper line parsing and generating. Fix PMs
Kim Alvefur <zash@zash.se>
parents:
465
diff
changeset
|
566 function commands.QUIT(session, args) |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
567 session.send{"ERROR", "Closing Link: "..session.nick}; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
568 for _, room in pairs(session.rooms) do |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
569 room:leave(args[1]); |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
570 end |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
571 jids[session.full_jid] = nil; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
572 nicks[session.nick] = nil; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
573 usernames[session.username] = nil; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
574 sessions[session.conn] = nil; |
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
575 session:close(); |
329 | 576 end |
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
577 |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
578 function commands.RAW(session, data) -- Empty command |
111
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
579 end |
3de60860adca
mod_ircd: Initial commit of a wonderfully hacky but working IRC->XMPP interface for Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
580 |
465
030404dd7609
mod_ircd: Better nameing, squishy.
Kim Alvefur <zash@zash.se>
parents:
461
diff
changeset
|
581 local function desetup() |
491
5b3db688213d
mod_ircd: Fixed nick change logic (thanks mva), so that the self nick-change "flag" is removed properly, improved the logic to use verse's room_mt:change_nick (thanks Zash) yet to be pushed into main, added squished verse with the meta method included.
Marco Cirillo <maranda@lightwitch.org>
parents:
490
diff
changeset
|
582 require "net.connlisteners".deregister("irc"); |
465
030404dd7609
mod_ircd: Better nameing, squishy.
Kim Alvefur <zash@zash.se>
parents:
461
diff
changeset
|
583 end |
030404dd7609
mod_ircd: Better nameing, squishy.
Kim Alvefur <zash@zash.se>
parents:
461
diff
changeset
|
584 |
487
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
585 require "net.connlisteners".register("irc", irc_listener); |
8bdab5489653
mod_ircd: code cleanup, added full logic for changing nicks (locally it works no traces), removed many comment lines (there was an over abundance of 'em they're in the .old_annotate file)
Marco Cirillo <maranda@lightwitch.org>
parents:
485
diff
changeset
|
586 require "net.connlisteners".start("irc"); |
326
282abba844e8
mod_ircd: Partial rewrite, use verse for MUC
Kim Alvefur <zash@zash.se>
parents:
282
diff
changeset
|
587 |
465
030404dd7609
mod_ircd: Better nameing, squishy.
Kim Alvefur <zash@zash.se>
parents:
461
diff
changeset
|
588 module:hook("module-unloaded", desetup) |