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 botconfig
|
||||||
import src.settings as var
|
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.messages import messages
|
||||||
from src.utilities import reply
|
from src.utilities import reply
|
||||||
from src.functions import get_participants, get_all_roles
|
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.Main = channels.add(botconfig.CHANNEL, cli)
|
||||||
channels.Dummy = channels.add("*", cli)
|
channels.Dummy = channels.add("*", cli)
|
||||||
|
|
||||||
|
context._who(cli, "ChanServ")
|
||||||
|
context._who(cli, "NickServ")
|
||||||
|
|
||||||
if botconfig.ALT_CHANNELS:
|
if botconfig.ALT_CHANNELS:
|
||||||
for chan in botconfig.ALT_CHANNELS.split(","):
|
for chan in botconfig.ALT_CHANNELS.split(","):
|
||||||
channels.add(chan, cli)
|
channels.add(chan, cli)
|
||||||
|
10
src/hooks.py
10
src/hooks.py
@ -47,6 +47,9 @@ def who_reply(cli, bot_server, bot_nick, chan, ident, host, server, nick, status
|
|||||||
modes = {Features["PREFIX"].get(s) for s in status} - {None}
|
modes = {Features["PREFIX"].get(s) for s in status} - {None}
|
||||||
|
|
||||||
user = users._add(cli, nick=nick, ident=ident, host=host, realname=realname) # FIXME
|
user = users._add(cli, nick=nick, ident=ident, host=host, realname=realname) # FIXME
|
||||||
|
if "serv" in nick.lower():
|
||||||
|
ch = channels.Dummy
|
||||||
|
else:
|
||||||
ch = channels.add(chan, cli)
|
ch = channels.add(chan, cli)
|
||||||
|
|
||||||
if ch not in user.channels:
|
if ch not in user.channels:
|
||||||
@ -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 = 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)
|
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())
|
users.add(nick, ident=ident, host=host, account="*", inchan=True, modes=modes, moded=set())
|
||||||
|
|
||||||
@hook("whospcrpl")
|
@hook("whospcrpl")
|
||||||
@ -110,6 +113,9 @@ def extended_who_reply(cli, bot_server, bot_nick, data, chan, ident, ip_address,
|
|||||||
modes = {Features["PREFIX"].get(s) for s in status} - {None}
|
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
|
user = users._add(cli, nick=nick, ident=ident, host=host, realname=realname, account=account) # FIXME
|
||||||
|
if "serv" in nick.lower():
|
||||||
|
ch = channels.Dummy
|
||||||
|
else:
|
||||||
ch = channels.add(chan, cli)
|
ch = channels.add(chan, cli)
|
||||||
|
|
||||||
if ch not in user.channels:
|
if ch not in user.channels:
|
||||||
@ -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 = 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)
|
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())
|
users.add(nick, ident=ident, host=host, account=account, inchan=True, modes=modes, moded=set())
|
||||||
|
|
||||||
@hook("endofwho")
|
@hook("endofwho")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user