Skip to content

Commit 9c69b13

Browse files
h-0-s-hflashcode
authored andcommitted
fix regex match
to account for CAPS/time feature on newer ircds (@time=2022-03-02T19:00:30.041Z :XXXX!~XXXX@xxxx INVITE yournick :#xxxxxxxx)
1 parent 045ca70 commit 9c69b13

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

python/autojoin_on_invite.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
# (this script requires WeeChat 0.3.0 or newer)
2121
#
2222
# History:
23+
# 2022-03-2, h-0-s-h <[email protected]>
24+
# version 0.8: fix reged parsing of INVITE message to account for ircv3/CAPS style/etc
25+
# (@time=2022-03-02T19:00:30.041Z :XXXXX!~XXXXX@xxxxx INVITE h-0-s-h :#xxxxx)
2326
# 2018-10-03, Pol Van Aubel <[email protected]>
2427
# version 0.7: Python3 compatibility. Considerations:
2528
# - Settings during registration are iterated over only once, so
@@ -86,7 +89,9 @@ def join(server, channel):
8689
def invite_cb(data, signal, signal_data):
8790
server = signal.split(',')[0] # EFNet,irc_in_INVITE
8891
channel = signal_data.split()[-1].lstrip(':') # :[email protected] INVITE yournick :#channel
89-
from_nick = re.match(':(?P<nick>.+)!', signal_data).groups()[0]
92+
from_nick = ''
93+
SearchStr = ':.*\:(?P<nick>.+)!' #@time=2022-03-02T19:00:30.041Z :[email protected] INVITE yournick :#xxxx-xxx
94+
from_nick = re.search(SearchStr, signal_data).groups()[0]
9095

9196
if len(w.config_get_plugin('whitelist_nicks')) > 0 and len(w.config_get_plugin('whitelist_channels')) > 0: # if there's two whitelists, accept both
9297
if from_nick in w.config_get_plugin('whitelist_nicks').split(',') or channel in w.config_get_plugin('whitelist_channels').split(','):

0 commit comments

Comments
 (0)