import hexchat

__module_name__ = 'MyMessages'
__module_author__ = 'TingPing'
__module_version__ = '2'
__module_description__ = 'Properly show your messages in znc with privmsg module'

def privmsg_cb(word, word_eol, userdata, attrs):
	mynick = hexchat.get_info('nick')
	sender = word[0].split('!')[0][1:]
	recipient = word[2]
	network = hexchat.get_info('network')
	msg = word_eol[3][1:]

	if hexchat.nickcmp(sender, mynick) == 0 and hexchat.nickcmp(recipient, mynick) != 0:
		if recipient[0] != '#':
			hexchat.command('query -nofocus {}'.format(recipient))
		hexchat.find_context(network, recipient).set()

		if '\001ACTION' in msg:
			for repl in ('\001ACTION', '\001'):
				msg = msg.replace(repl, '')
			hexchat.emit_print('Your Action', mynick, msg.strip(), time=attrs.time)
		else:
			hexchat.emit_print('Your Message', mynick, msg, time=attrs.time)

		return hexchat.EAT_ALL

hexchat.hook_server_attrs('PRIVMSG', privmsg_cb)

@@ -93,17 +93,17 @@
 on__ = '
-2
+3
 '%0A__modu
@@ -157,31 +157,11 @@
  in 
-znc with privmsg module
+ZNC
 '%0A%0Ad
@@ -208,16 +208,119 @@
 attrs):%0A
+%09# We only care about private messages, HexChat handles the rest now.%0A%09if word%5B2%5D%5B0%5D == '#':%0A%09%09return%0A%0A
 %09mynick 
@@ -556,35 +556,8 @@
  0:%0A
-%09%09if recipient%5B0%5D != '#':%0A%09
 %09%09he

Update mymsg.py