Preemptively store services in a dummy channel for get() purposes
This commit is contained in:
parent
ef6758e14b
commit
33051ae617
@ -10,7 +10,7 @@ import functools
|
||||
|
||||
import botconfig
|
||||
import src.settings as var
|
||||
from src import decorators, wolfgame, events, channels, hooks, users, errlog as log, stream_handler as alog
|
||||
from src import decorators, wolfgame, events, context, channels, hooks, users, errlog as log, stream_handler as alog
|
||||
from src.messages import messages
|
||||
from src.utilities import reply
|
||||
from src.functions import get_participants, get_all_roles
|
||||
@ -161,6 +161,9 @@ def connect_callback(cli):
|
||||
channels.Main = channels.add(botconfig.CHANNEL, cli)
|
||||
channels.Dummy = channels.add("*", cli)
|
||||
|
||||
context._who(cli, "ChanServ")
|
||||
context._who(cli, "NickServ")
|
||||
|
||||
if botconfig.ALT_CHANNELS:
|
||||
for chan in botconfig.ALT_CHANNELS.split(","):
|
||||
channels.add(chan, cli)
|
||||
|
14
src/hooks.py
14
src/hooks.py
@ -47,7 +47,10 @@ def who_reply(cli, bot_server, bot_nick, chan, ident, host, server, nick, status
|
||||
modes = {Features["PREFIX"].get(s) for s in status} - {None}
|
||||
|
||||
user = users._add(cli, nick=nick, ident=ident, host=host, realname=realname) # FIXME
|
||||
ch = channels.add(chan, cli)
|
||||
if "serv" in nick.lower():
|
||||
ch = channels.Dummy
|
||||
else:
|
||||
ch = channels.add(chan, cli)
|
||||
|
||||
if ch not in user.channels:
|
||||
user.channels[ch] = modes
|
||||
@ -60,7 +63,7 @@ def who_reply(cli, bot_server, bot_nick, chan, ident, host, server, nick, status
|
||||
event = Event("who_result", {}, away=is_away, data=0, ip_address=None, server=server, hop_count=hop, idle_time=None, extended_who=False)
|
||||
event.dispatch(var, ch, user)
|
||||
|
||||
if ch is channels.Main and not users.exists(nick): # FIXME
|
||||
if ch is channels.Main and not users.exists(nick) and ch is not channels.Dummy: # FIXME
|
||||
users.add(nick, ident=ident, host=host, account="*", inchan=True, modes=modes, moded=set())
|
||||
|
||||
@hook("whospcrpl")
|
||||
@ -110,7 +113,10 @@ def extended_who_reply(cli, bot_server, bot_nick, data, chan, ident, ip_address,
|
||||
modes = {Features["PREFIX"].get(s) for s in status} - {None}
|
||||
|
||||
user = users._add(cli, nick=nick, ident=ident, host=host, realname=realname, account=account) # FIXME
|
||||
ch = channels.add(chan, cli)
|
||||
if "serv" in nick.lower():
|
||||
ch = channels.Dummy
|
||||
else:
|
||||
ch = channels.add(chan, cli)
|
||||
|
||||
if ch not in user.channels:
|
||||
user.channels[ch] = modes
|
||||
@ -123,7 +129,7 @@ def extended_who_reply(cli, bot_server, bot_nick, data, chan, ident, ip_address,
|
||||
event = Event("who_result", {}, away=is_away, data=data, ip_address=ip_address, server=server, hop_count=hop, idle_time=idle, extended_who=True)
|
||||
event.dispatch(var, ch, user)
|
||||
|
||||
if ch is channels.Main and not users.exists(nick): # FIXME
|
||||
if ch is channels.Main and not users.exists(nick) and ch is not channels.Dummy: # FIXME
|
||||
users.add(nick, ident=ident, host=host, account=account, inchan=True, modes=modes, moded=set())
|
||||
|
||||
@hook("endofwho")
|
||||
|
Loading…
x
Reference in New Issue
Block a user