coding styles in hawke commit: doesnt --> does not, nick --> nickname (Gajim user is grandma not hacker), spaces between operators, fixing one string (the rest I leave for the orignial author in 80 margin with python strings concentation)

This commit is contained in:
Nikos Kouremenos 2005-09-15 12:21:39 +00:00
parent b9e2ddbe65
commit 18c04d4323
1 changed files with 50 additions and 31 deletions

View File

@ -642,9 +642,9 @@ class GroupchatWindow(chat.Chat):
nick = message_array.pop(0) nick = message_array.pop(0)
nicks = self.get_nick_list(room_jid) nicks = self.get_nick_list(room_jid)
if nick in nicks: if nick in nicks:
self.on_send_pm(nick=nick) self.on_send_pm(nick = nick)
else: else:
self.print_conversation(_('Nick not found: %s') % nick, room_jid) self.print_conversation(_('Nickname not found: %s') % nick, room_jid)
else: else:
self.get_command_help(command) self.get_command_help(command)
elif command == 'msg': elif command == 'msg':
@ -658,7 +658,7 @@ class GroupchatWindow(chat.Chat):
privmsg = ' '.join(message_array) privmsg = ' '.join(message_array)
self.on_send_pm(nick=nick, msg=privmsg) self.on_send_pm(nick=nick, msg=privmsg)
else: else:
self.print_conversation(_('Nick not found: %s') % nick, room_jid) self.print_conversation(_('Nickname not found: %s') % nick, room_jid)
else: else:
self.get_command_help(command) self.get_command_help(command)
elif command == 'topic': elif command == 'topic':
@ -679,9 +679,14 @@ class GroupchatWindow(chat.Chat):
if invitee.find('@') >= 0: if invitee.find('@') >= 0:
reason = ' '.join(message_array) reason = ' '.join(message_array)
gajim.connections[self.account].send_invite(room_jid, invitee, reason) gajim.connections[self.account].send_invite(room_jid, invitee, reason)
self.print_conversation(_('Invited %s to %s.') % (invitee, room_jid), room_jid) s = _('Invited %(contact_jid)s to %(room_jid)s.') % {
'contact_jid': invitee,
'room_jid': room_jid}
self.print_conversation(s, room_jid)
else: else:
self.print_conversation(_('%s doesn\'t appear to be a JID') % invitee, room_jid) #%s is something the user wrote but it is not a jid so we inform
s = _('%s does not appear to be a JID') % invitee
self.print_conversation(s, room_jid)
else: else:
self.get_command_help(command) self.get_command_help(command)
elif command == 'join': elif command == 'join':
@ -691,19 +696,25 @@ class GroupchatWindow(chat.Chat):
if message_array.find('@') >= 0: if message_array.find('@') >= 0:
room, servernick = message_array.split('@') room, servernick = message_array.split('@')
if servernick.find('/') >= 0: if servernick.find('/') >= 0:
server, nick = servernick.split('/',1) server, nick = servernick.split('/', 1)
else: else:
server = servernick server = servernick
nick = '' nick = ''
#FIXME: autojoin with current nick or with the nick specified
#do not open join_gc window
if self.plugin.windows[self.account].has_key('join_gc'): if self.plugin.windows[self.account].has_key('join_gc'):
self.plugin.windows[self.account]['join_gc'].window.present() self.plugin.windows[self.account]['join_gc'].window.present()
else: else:
try: try:
self.plugin.windows[self.account]['join_gc'] = dialogs.JoinGroupchatWindow(self.plugin, self.account, server=server, room=room, nick=nick) self.plugin.windows[self.account]['join_gc'] =\
dialogs.JoinGroupchatWindow(self.plugin, self.account,
server = server, room = room, nick = nick)
except RuntimeError: except RuntimeError:
pass pass
else: else:
self.print_conversation(_('%s doesn\'t appear to be a JID') % message_array, room_jid) #%s is something the user wrote but it is not a jid so we inform
s = _('%s does not appear to be a JID') % message_array
self.print_conversation(s, room_jid)
else: else:
self.get_command_help(command) self.get_command_help(command)
elif command == 'leave' or command == 'part' or command == 'close': elif command == 'leave' or command == 'part' or command == 'close':
@ -721,11 +732,14 @@ class GroupchatWindow(chat.Chat):
reason = ' '.join(message_array) reason = ' '.join(message_array)
if nick in room_nicks: if nick in room_nicks:
ban_jid = gajim.construct_fjid(room_jid, nick) ban_jid = gajim.construct_fjid(room_jid, nick)
gajim.connections[self.account].gc_set_affiliation(room_jid, ban_jid, 'outcast', reason) gajim.connections[self.account].gc_set_affiliation(room_jid,
ban_jid, 'outcast', reason)
elif nick.find('@') >= 0: elif nick.find('@') >= 0:
gajim.connections[self.account].gc_set_affiliation(room_jid, nick, 'outcast', reason) gajim.connections[self.account].gc_set_affiliation(room_jid,
nick, 'outcast', reason)
else: else:
self.print_conversation(_('Nick not found: %s') % nick, room_jid) self.print_conversation(_('Nickname not found: %s') % nick,
room_jid)
else: else:
self.get_command_help(command) self.get_command_help(command)
elif command == 'kick': elif command == 'kick':
@ -735,9 +749,11 @@ class GroupchatWindow(chat.Chat):
room_nicks = self.get_nick_list(room_jid) room_nicks = self.get_nick_list(room_jid)
reason = ' '.join(message_array) reason = ' '.join(message_array)
if nick in room_nicks: if nick in room_nicks:
gajim.connections[self.account].gc_set_role(room_jid, nick, 'none', reason) gajim.connections[self.account].gc_set_role(room_jid, nick,
'none', reason)
else: else:
self.print_conversation(_('Nick not found: %s') % nick, room_jid) self.print_conversation(_('Nickname not found: %s') % nick,
room_jid)
else: else:
self.get_command_help(command) self.get_command_help(command)
elif command == 'help': elif command == 'help':
@ -748,12 +764,15 @@ class GroupchatWindow(chat.Chat):
self.get_command_help(command) self.get_command_help(command)
elif command == 'me': elif command == 'me':
if len(message_array): if len(message_array):
gajim.connections[self.account].send_gc_message(room_jid, '/'+message) gajim.connections[self.account].send_gc_message(room_jid,
'/' + message)
else: else:
self.get_command_help(command) self.get_command_help(command)
else: else:
self.print_conversation(_('No such command: /%s') % command, room_jid) self.print_conversation(_('No such command: /%s') % command,
room_jid)
return # don't print the command return # don't print the command
gajim.connections[self.account].send_gc_message(room_jid, message) gajim.connections[self.account].send_gc_message(room_jid, message)
message_textview.grab_focus() message_textview.grab_focus()
@ -762,12 +781,13 @@ class GroupchatWindow(chat.Chat):
if command == 'help': if command == 'help':
self.print_conversation(_('Commands: %s') % self.muc_cmds, room_jid) self.print_conversation(_('Commands: %s') % self.muc_cmds, room_jid)
elif command == 'ban': elif command == 'ban':
self.print_conversation(_('Usage: /%s <nick|JID> [reason], bans the JID \ s = _('Usage: /%s <nickname|JID> [reason], bans the JID from the room.'
from the room. The nick of an occupant may be substituted, but not if it \ ' The nickname of an occupant may be substituted, but not if it contains "@".'
contains \'@\'. If the JID is currently in the room, he/she/it will also be \ ' If the JID is currently in the room, he/she/it will also be kicked.'
kicked. Does NOT support spaces in nick.') % command, room_jid) ' Does NOT support spaces in nickname.') % command
self.print_conversation(s, room_jid)
elif command == 'chat' or command == 'query': elif command == 'chat' or command == 'query':
self.print_conversation(_('Usage: /%s <nick>, opens a private chat window \ self.print_conversation(_('Usage: /%s <nickname>, opens a private chat window \
to the specified occupant.') % command, room_jid) to the specified occupant.') % command, room_jid)
elif command == 'clear': elif command == 'clear':
self.print_conversation(_('Usage: /%s, clears the text window.') % command, self.print_conversation(_('Usage: /%s, clears the text window.') % command,
@ -782,23 +802,22 @@ compact mode.') % command, room_jid)
self.print_conversation(_('Usage: /%s <JID> [reason], invites JID to the \ self.print_conversation(_('Usage: /%s <JID> [reason], invites JID to the \
current room, optionally providing a reason.') % command, room_jid) current room, optionally providing a reason.') % command, room_jid)
elif command == 'join': elif command == 'join':
self.print_conversation(_('Usage: /%s <room>@<server>[/nick], offers to \ self.print_conversation(_('Usage: /%s <room>@<server>[/nickname], offers to \
join room@server optionally using specified nick.') % command, room_jid) join room@server optionally using specified nickname.') % command, room_jid)
elif command == 'kick': elif command == 'kick':
self.print_conversation(_('Usage: /%s <nick> [reason], removes the \ self.print_conversation(_('Usage: /%s <nickname> [reason], removes the \
occupant specified by nick from the room and optionally displays a \ occupant specified by nickname from the room and optionally displays a \
reason. Does NOT support spaces in nick.') % command, room_jid) reason. Does NOT support spaces in nickname.') % command, room_jid)
elif command == 'me': elif command == 'me':
self.print_conversation(_('Usage: /%s <action>, sends action to the \ self.print_conversation(_('Usage: /%s <action>, sends action to the \
current room. Use third person. (e.g. /%s explodes.)') % current room. Use third person. (e.g. /%s explodes)') %
(command, command), room_jid) (command, command), room_jid)
elif command == 'msg': elif command == 'msg':
self.print_conversation(_('Usage: /%s <nick> [message], opens a private \ s = _('Usage: /%s <nickname> [message], opens a private message window and sends message to the occupant specified by nickname.') % command
message window and sends message to the occupant specified by nick.') % self.print_conversation(s, room_jid)
command, room_jid)
elif command == 'nick': elif command == 'nick':
self.print_conversation(_('Usage: /%s <nick>, changes your nick in current \ s = _('Usage: /%s <nickname>, changes your nickname in current room.') % command
room.') % command, room_jid) self.print_conversation(s, room_jid)
elif command == 'topic': elif command == 'topic':
self.print_conversation(_('Usage: /%s [topic], displays or updatesthe \ self.print_conversation(_('Usage: /%s [topic], displays or updatesthe \
current room topic.') % command, room_jid) current room topic.') % command, room_jid)