Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo Silva <edsiper@gmail.com>2008-01-07 16:27:52 (GMT)
committer Eduardo Silva <edsiper@gmail.com>2008-01-07 16:27:52 (GMT)
commit7339355db4e7cf2892588859fd7dac97ad56d1bb (patch)
tree94815a5c2354e1f85af754091d710b00b8c4271c
parentb096400e4611197b25b73656136829d64d2fee53 (diff)
Fix /me command (#5598), thanks Phil!!
-rw-r--r--purk/scripts/irc_script.py10
-rw-r--r--purk/scripts/theme.py13
2 files changed, 20 insertions, 3 deletions
diff --git a/purk/scripts/irc_script.py b/purk/scripts/irc_script.py
index 0c91286..08a0b96 100644
--- a/purk/scripts/irc_script.py
+++ b/purk/scripts/irc_script.py
@@ -251,6 +251,15 @@ def onCommandQuery(e):
if message: #this is false if you do "/query nickname "
e.network.msg(e.args[0], ' '.join(e.args[1:]))
+
+def onCommandAction(e):
+ if isinstance(e.window, windows.ChannelWindow) or isinstance(e.window, windows.QueryWindow):
+ e.network.msg(e.window.id, '\x01ACTION ' + ' '.join(e.args) + '\x01')
+ else:
+ raise core.events.CommandError("There's no one here to speak to.")
+
+onCommandMe = onCommandAction
+
def setupJoin(e):
if e.source == e.network.me:
chan = e.network.norm_case(e.channel)
@@ -328,6 +337,7 @@ def onCommandJoin(e):
else:
raise core.events.CommandError("You must supply a channel.")
+
def onCommandPart(e):
if e.args:
if e.network.status >= irc.INITIALIZING:
diff --git a/purk/scripts/theme.py b/purk/scripts/theme.py
index ca01877..d4c77ca 100644
--- a/purk/scripts/theme.py
+++ b/purk/scripts/theme.py
@@ -164,7 +164,11 @@ def onText(e):
hilight_text(e)
color = getsourcecolor(e)
to_write = prefix(e)
- if e.network.me == e.target: # this is a pm
+
+ if len(e.text) > 8 and e.text[0:7] == "\x01ACTION":
+ # This is an action.
+ to_write += "%s %s" % (format_source(e), e.text[7:-1])
+ elif e.network.me == e.target: # this is a pm
if e.window.id == e.network.norm_case(e.source):
to_write += "\x02<\x0F%s\x0F\x02>\x0F " % (format_source(e))
else:
@@ -175,7 +179,7 @@ def onText(e):
else:
to_write += "\x02<\x0F%s:%s\x0F\x02>\x0F " % (format_source(e), e.target)
to_write += e.text
-
+
if e.Highlight:
e.window.write(to_write, widgets.HILIT)
else:
@@ -184,7 +188,10 @@ def onText(e):
def onOwnText(e):
color = getsourcecolor(e)
to_write = prefix(e)
- if e.window.id == e.network.norm_case(e.target):
+ if len(e.text) > 8 and e.text[0:7] == "\x01ACTION":
+ # This is an action.
+ to_write += "%s%s" % (format_source(e), e.text[7:-1])
+ elif e.window.id == e.network.norm_case(e.target):
to_write += "\x02<\x0F%s\x0F\x02>\x0F %s" % (format_source(e), e.text)
else:
to_write += "%s->\x0F \x02*\x0F%s\x0F\x02*\x0F %s" % (color, e.target, e.text)