3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-25 04:02:45 +01:00

inspircd: add GLINE support (#139)

This commit is contained in:
James Lu 2017-07-17 05:24:07 -07:00
parent c7c29f35e5
commit ab8a922809

View File

@ -373,6 +373,19 @@ class InspIRCdProtocol(TS6BaseProtocol):
self._send_with_prefix(sid, 'ENDBURST') self._send_with_prefix(sid, 'ENDBURST')
return sid return sid
def set_server_ban(self, source, duration, user='*', host='*', reason='User banned'):
"""
Sets a server ban.
"""
# <- :70M ADDLINE G *@10.9.8.7 midnight.local 1433704565 0 :gib reason pls kthx
assert not (user == host == '*'), "Refusing to set ridiculous ban on *@*"
# Per https://wiki.inspircd.org/InspIRCd_Spanning_Tree_1.2/ADDLINE, the setter argument can
# be a max of 64 characters
self._send_with_prefix(source, 'ADDLINE G %s@%s %s %s %s :%s' % (user, host, self.get_friendly_name(source)[:64],
int(time.time()), duration, reason))
### Core / command handlers ### Core / command handlers
def post_connect(self): def post_connect(self):