Merge with 5b124dac82e5ce6b3be2a3659bcbab12799e2220

This commit is contained in:
Stephan Erb 2009-10-12 19:55:42 +02:00
commit 8aaee30f23
5 changed files with 19 additions and 9 deletions

View File

@ -270,6 +270,16 @@ def adapt_arguments(command, arguments, args, opts):
if value not in initial: if value not in initial:
raise CommandError("%s: Invalid argument" % key, command) raise CommandError("%s: Invalid argument" % key, command)
# If argument to an option constrained by a sequence was not given - then
# it's value should be set to None.
for spec_key, spec_value in spec_kwargs:
if isinstance(spec_value, (TupleType, ListType)):
for key, value in opts:
if spec_key == key:
break
else:
opts.append((spec_key, None))
# We need to encode every keyword argument to a simple string, not the # We need to encode every keyword argument to a simple string, not the
# unicode one, because ** expansion does not support it. # unicode one, because ** expansion does not support it.
for index, (key, value) in enumerate(opts): for index, (key, value) in enumerate(opts):

View File

@ -351,7 +351,7 @@ class ConnectionBytestream:
file_props['hash'] = hash_id file_props['hash'] = hash_id
return return
def _connect_error(self, to, _id, sid, code = 404): def _connect_error(self, to, _id, sid, code=404):
''' cb, when there is an error establishing BS connection, or ''' cb, when there is an error establishing BS connection, or
when connection is rejected''' when connection is rejected'''
if not self.connection or self.connected < 2: if not self.connection or self.connected < 2:

View File

@ -212,10 +212,10 @@ def get_server_from_jid(jid):
pos = jid.find('@') + 1 # after @ pos = jid.find('@') + 1 # after @
return jid[pos:] return jid[pos:]
def get_nick_from_fjid(jid): def get_resource_from_jid(jid):
# fake jid is the jid for a contact in a room tokens = jid.split('/', 1)
# gaim@conference.jabber.no/nick/nick-continued if len(tokens) > 1:
return jid.split('/', 1)[1] return tokens[1]
def get_name_and_server_from_jid(jid): def get_name_and_server_from_jid(jid):
name = get_nick_from_jid(jid) name = get_nick_from_jid(jid)

View File

@ -849,7 +849,7 @@ class RosterWindow:
self.remove_contact(jid, account, force=True, backend=True) self.remove_contact(jid, account, force=True, backend=True)
return True return True
def rename_group(self, old_name, new_name): def rename_group(self, old_name, new_name, account):
""" """
rename a roster group rename a roster group
""" """
@ -2396,7 +2396,7 @@ class RosterWindow:
else: # user is running svn else: # user is running svn
helpers.exec_command('%s history_manager.py' % sys.executable) helpers.exec_command('%s history_manager.py' % sys.executable)
else: # Unix user else: # Unix user
helpers.exec_command('%s history_manager.py &' % sys.executable) helpers.exec_command('%s history_manager.py' % sys.executable)
def on_info(self, widget, contact, account): def on_info(self, widget, contact, account):
'''Call vcard_information_window class to display contact's information''' '''Call vcard_information_window class to display contact's information'''
@ -2756,7 +2756,7 @@ class RosterWindow:
win.show_title() win.show_title()
elif row_type == 'group': elif row_type == 'group':
# in C_JID column, we hold the group name (which is not escaped) # in C_JID column, we hold the group name (which is not escaped)
self.rename_group(old_text, new_text) self.rename_group(old_text, new_text, account)
def on_canceled(): def on_canceled():
if 'rename' in gajim.interface.instances: if 'rename' in gajim.interface.instances:

View File

@ -86,7 +86,7 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
'''dispatch a received <message> stanza''' '''dispatch a received <message> stanza'''
msg_type = msg.getType() msg_type = msg.getType()
subject = msg.getSubject() subject = msg.getSubject()
resource = gajim.get_nick_from_fjid(full_jid_with_resource) resource = gajim.get_resource_from_jid(full_jid_with_resource)
if self.resource != resource: if self.resource != resource:
self.resource = resource self.resource = resource
if self.control and self.control.resource: if self.control and self.control.resource: