Skip to content

Commit

Permalink
Strip mIRC color codes from messages
Browse files Browse the repository at this point in the history
The ^C/\x03 control character was already stripped, but not the foreground and background colors after it.
  • Loading branch information
irisfofs committed Jan 3, 2016
1 parent 8774257 commit 507acfe
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions skype2irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import sys, signal
import time, datetime
import string, textwrap
import re
import json

from ircbot import SingleServerIRCBot
Expand Down Expand Up @@ -256,6 +257,8 @@ def on_pong(self, connection, event):
def say(self, target, msg, do_say = True):
"""Send messages to channels/nicks"""
try:
# Strip mIRC color codes (\x03XX,YY) from the message
msg = re.sub(r"\x03\d+(,\d+)?", "", msg)
lines = msg.encode("UTF-8").split("\n")
cur = 0
for line in lines:
Expand Down

0 comments on commit 507acfe

Please sign in to comment.