diff --git a/coremods/service_support.py b/coremods/service_support.py index ec26e58..5ef98f3 100644 --- a/coremods/service_support.py +++ b/coremods/service_support.py @@ -26,6 +26,10 @@ def spawn_service(irc, source, command, args): nick = irc.serverdata.get("%s_nick" % name) or conf.conf.get(name, {}).get('nick') or sbot.nick or name ident = irc.serverdata.get("%s_ident" % name) or conf.conf.get(name, {}).get('ident') or sbot.ident or name + # Specify modes to join the services bot with. + joinmodes = irc.serverdata.get("%s_joinmodes" % name) or conf.conf.get(name, {}).get('joinmodes') or '' + joinmodes = ''.join([m for m in joinmodes if m in irc.prefixmodes]) + if name != 'pylink' and irc.protoname == 'clientbot': # Prefix service bots spawned on Clientbot to prevent possible nick collisions. nick = 'PyLinkService@' + nick @@ -65,7 +69,12 @@ def spawn_service(irc, source, command, args): for chan in channels: if utils.isChannel(chan): - irc.proto.join(u, chan) + log.debug('(%s) Joining services %s to channel %s with modes %r', irc.name, name, chan, joinmodes) + if joinmodes: # Modes on join were specified; use SJOIN to burst our service + irc.proto.sjoin(irc.sid, chan, [(joinmodes, u)]) + else: + irc.proto.join(u, chan) + irc.callHooks([irc.sid, 'PYLINK_SERVICE_JOIN', {'channel': chan, 'users': [u]}]) else: log.warning('(%s) Ignoring invalid autojoin channel %r.', irc.name, chan) diff --git a/example-conf.yml b/example-conf.yml index aa8e716..9bf9270 100644 --- a/example-conf.yml +++ b/example-conf.yml @@ -488,3 +488,8 @@ games: automode: # Sets the nick of the Automode service, if you're using it. This defaults to "automode" if not defined. nick: Automode + + # For each service, you can also specify what prefix modes you want the service bot to join channels with. + # Setting this to op (+o) for Automode makes it appear more like a standard IRC service, and lessens + # the risk of mode overrides being dropped. + joinmodes: 'o'