Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Bordelon <phil@thenexusproject.org>2008-01-30 00:27:45 (GMT)
committer Phil Bordelon <phil@thenexusproject.org>2008-01-30 00:27:45 (GMT)
commitb9b83f630eda16ed36ddbb5ce6dee21e667c052f (patch)
treef2f7626f615176e6ce4c59b4e1824e2bb5bc38db
parent751fd5857cfc510b3ed6a00d1d4d7a0bcd40241a (diff)
Synchronize XoIRC properly with the patches I've already pushed upstream.
This patch removes some whitespace that crept in from the way that prior patches were applied, and also fixes a bit that wasn't added properly that made other people's actions look "duplicated."
-rw-r--r--purk/irc.py44
-rw-r--r--purk/scripts/irc_script.py11
-rw-r--r--purk/scripts/theme.py24
3 files changed, 42 insertions, 37 deletions
diff --git a/purk/irc.py b/purk/irc.py
index 5978c3a..edd8a4b 100644
--- a/purk/irc.py
+++ b/purk/irc.py
@@ -43,34 +43,36 @@ def default_nicks():
try:
nicks = [conf.get('nick')] + conf.get('altnicks',[])
if not nicks[0]:
- # We're going to generate a nick based on the user's nick name
- # and their public key.
- import sugar.profile
- import hashlib
- user_name = sugar.profile.get_nick_name()
- pubkey = sugar.profile.get_pubkey()
- m = hashlib.sha1()
- m.update(pubkey)
+ # We're going to generate a nick based on the user's nick name
+ # and their public key.
+ import sugar.profile
+ import hashlib
+
+ user_name = sugar.profile.get_nick_name()
+ pubkey = sugar.profile.get_pubkey()
+ m = hashlib.sha1()
+ m.update(pubkey)
hexhash = m.hexdigest()
- # Okay. Get all of the alphabetic bits of the username:
- user_name_letters = "".join([x for x in user_name if x.isalpha()])
+ # Okay. Get all of the alphabetic bits of the username:
+ user_name_letters = "".join([x for x in user_name if x.isalpha()])
+
+ # If that came up with nothing, make it 'XO'. Also, shorten it
+ # if it's more than 11 characters (as we need 5 for - and the
+ # hash).
+ if len(user_name_letters) == 0:
+ user_name_letters = "XO"
+ if len(user_name_letters) > 11:
+ user_name_letters = user_name_letters[0:11]
- # If that came up with nothing, make it 'XO'. Also, shorten it
- # if it's more than 11 characters (as we need 5 for - and the
- # hash).
- if len(user_name_letters) == 0:
- user_name_letters = "XO"
- if len(user_name_letters) > 11:
- user_name_letters = user_name_letters[0:11]
+ # Finally, generate a nick by using those letters plus the first
+ # four hash bits of the user's public key.
+ user_nick = user_name_letters + "-" + hexhash[0:4]
- # Finally, generate a nick by using those letters plus the first
- # four hash bits of the user's public key.
- user_nick = user_name_letters + "-" + hexhash[0:4]
nicks = [user_nick]
except:
- nicks = ["mrurk"]
+ nicks = ["purk"]
return nicks
class Network(object):
diff --git a/purk/scripts/irc_script.py b/purk/scripts/irc_script.py
index 45d1053..6e38005 100644
--- a/purk/scripts/irc_script.py
+++ b/purk/scripts/irc_script.py
@@ -251,12 +251,11 @@ 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.")
+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
diff --git a/purk/scripts/theme.py b/purk/scripts/theme.py
index d4c77ca..5afd8fa 100644
--- a/purk/scripts/theme.py
+++ b/purk/scripts/theme.py
@@ -165,21 +165,23 @@ def onText(e):
color = getsourcecolor(e)
to_write = prefix(e)
- 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 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:
to_write += "\x02*\x0F%s\x0F\x02*\x0F " % (format_source(e))
+ to_write += e.text
else:
if e.window.id == e.network.norm_case(e.target):
to_write += "\x02<\x0F%s\x0F\x02>\x0F " % (format_source(e))
else:
to_write += "\x02<\x0F%s:%s\x0F\x02>\x0F " % (format_source(e), e.target)
- to_write += e.text
-
+ to_write += e.text
+
if e.Highlight:
e.window.write(to_write, widgets.HILIT)
else:
@@ -188,10 +190,12 @@ def onText(e):
def onOwnText(e):
color = getsourcecolor(e)
to_write = prefix(e)
- 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):
+
+ 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)