-
Notifications
You must be signed in to change notification settings - Fork 7
/
pyprivmsg.py
33 lines (27 loc) · 1.21 KB
/
pyprivmsg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
Based entirely on privmsg.cpp located at
https://github.com/kylef/znc-contrib because I was too lazy to compile
my own znc.
Copyright (C) 2004-2012
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 as published
by the Free Software Foundation.
"""
import znc
class pyprivmsg(znc.Module):
module_types = [znc.CModInfo.NetworkModule, znc.CModInfo.GlobalModule]
description = "Send outgoing PRIVMSGs and CTCP ACTIONs to other clients"
def OnUserMsg(self, target, message):
net = self.GetNetwork()
if net.GetIRCSock() and not net.IsChan(target):
nickmask = net.GetIRCNick().GetNickMask()
client = self.GetClient()
self.PutUser(":{} PRIVMSG {} :{}"
.format(nickmask, target, message), None, client)
def OnUserAction(self, target, message):
net = self.GetNetwork()
if net.GetIRCSock() and not net.IsChan(target):
nickmask = net.GetIRCNick().GetNickMask()
client = self.GetClient()
self.PutUser(":{} PRIVMSG {} :\x01ACTION {} \x01"
.format(nickmask, target, message), None, client)