Merged revisions 4987-4989,4991-4996,4999,5003 via svnmerge from

svn://svn.gajim.org/gajim/trunk

........
r4987 | nk | 2006-01-03 04:00:51 -0700 (Tue, 03 Jan 2006) | 1 line

commit 48x48 transport online/offline imgs by Grenshad (I pngcrushed them)
........
r4988 | nk | 2006-01-03 04:32:01 -0700 (Tue, 03 Jan 2006) | 1 line

icon in notification window not always jabber now. MSN if he uses msn etc. thanks stian barmen for helping me test
........
r4989 | nk | 2006-01-03 04:40:44 -0700 (Tue, 03 Jan 2006) | 1 line

all strings I got report about them, are not translatable; pot/po update
........
r4991 | asterix | 2006-01-03 08:08:21 -0700 (Tue, 03 Jan 2006) | 2 lines

don't remove the jid entry in _contacts[account] when we remove a contact

........
r4992 | asterix | 2006-01-03 08:18:30 -0700 (Tue, 03 Jan 2006) | 2 lines

fix logic

........
r4993 | asterix | 2006-01-03 09:04:14 -0700 (Tue, 03 Jan 2006) | 2 lines

a GC_Contact can have a resource if we knoe his real JID

........
r4994 | asterix | 2006-01-03 09:32:58 -0700 (Tue, 03 Jan 2006) | 2 lines

missing argument in create_gc_contact

........
r4995 | asterix | 2006-01-03 10:36:41 -0700 (Tue, 03 Jan 2006) | 2 lines

we save gc_contact vcard instance in instances[self.account]['infos'][Fake_jid]

........
r4996 | asterix | 2006-01-03 11:17:43 -0700 (Tue, 03 Jan 2006) | 2 lines

in DataForm, a field of type 'list-single' can have no <value> element. Create a default one in such a case to prevent TB

........
r4999 | asterix | 2006-01-04 05:52:26 -0700 (Wed, 04 Jan 2006) | 2 lines

prevent TB when we move a contact that was in no group

........
r5003 | asterix | 2006-01-04 09:03:42 -0700 (Wed, 04 Jan 2006) | 2 lines

handle correctly unlabeled option values in DataForms

........
This commit is contained in:
Travis Shirk 2006-01-05 03:17:36 +00:00
parent a950a51e28
commit 757ed426e3
36 changed files with 13694 additions and 12809 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1238,13 +1238,16 @@ class Connection:
for option_tag in option_tags: for option_tag in option_tags:
dic[i]['options'][j] = {} dic[i]['options'][j] = {}
label = option_tag.getAttr('label') label = option_tag.getAttr('label')
if label:
dic[i]['options'][j]['label'] = label
tags = option_tag.getTags('value') tags = option_tag.getTags('value')
dic[i]['options'][j]['values'] = [] dic[i]['options'][j]['values'] = []
for tag in tags: for tag in tags:
dic[i]['options'][j]['values'].append(tag.getData()) dic[i]['options'][j]['values'].append(tag.getData())
j += 1 j += 1
if not label:
label = dic[i]['options'][j]['values'][0]
dic[i]['options'][j]['label'] = label
if not dic[i].has_key('values'):
dic[i]['values'] = [dic[i]['options'][0]['values'][0]]
i += 1 i += 1
return dic return dic

View File

@ -66,11 +66,12 @@ class Contact(ContactBase):
class GC_Contact(ContactBase): class GC_Contact(ContactBase):
'''Information concerning each groupchat contact''' '''Information concerning each groupchat contact'''
def __init__(self, room_jid='', name='', show='', status='', role='', def __init__(self, room_jid='', name='', show='', status='', role='',
affiliation='', jid = ''): affiliation='', jid = '', resource = ''):
ContactBase.__init__(self, jid = jid, name = name, status = status, show = show) ContactBase.__init__(self, jid = jid, name = name, status = status, show = show)
self.room_jid = room_jid self.room_jid = room_jid
self.role = role self.role = role
self.affiliation = affiliation self.affiliation = affiliation
self.resource = resource
def get_full_jid(self): def get_full_jid(self):
return self.room_jid + '/' + self.name return self.room_jid + '/' + self.name
@ -135,10 +136,7 @@ class Contacts:
return return
if contact in self._contacts[account][contact.jid]: if contact in self._contacts[account][contact.jid]:
self._contacts[account][contact.jid].remove(contact) self._contacts[account][contact.jid].remove(contact)
# It was the last resource of this contact ?
if not len(self._contacts[account][contact.jid]):
del self._contacts[account][contact.jid]
def remove_jid(self, account, jid): def remove_jid(self, account, jid):
'''Removes all contacts for a given jid''' '''Removes all contacts for a given jid'''
if not self._contacts.has_key(account): if not self._contacts.has_key(account):
@ -235,8 +233,9 @@ class Contacts:
sub = 'none') sub = 'none')
def create_gc_contact(self, room_jid='', name='', show='', status='', def create_gc_contact(self, room_jid='', name='', show='', status='',
role='', affiliation='', jid=''): role='', affiliation='', jid='', resource=''):
return GC_Contact(room_jid, name, show, status, role, affiliation, jid) return GC_Contact(room_jid, name, show, status, role, affiliation, jid,
resource)
def add_gc_contact(self, account, gc_contact): def add_gc_contact(self, account, gc_contact):
# No such account before ? # No such account before ?

View File

@ -189,7 +189,8 @@ def get_number_of_accounts():
return len(connections.keys()) return len(connections.keys())
def get_transport_name_from_jid(jid, use_config_setting = True): def get_transport_name_from_jid(jid, use_config_setting = True):
'''returns 'aim', 'gg', 'irc' etc''' '''returns 'aim', 'gg', 'irc' etc
if JID is not from transport returns None'''
#FIXME: jid can be None! one TB I saw had this problem: #FIXME: jid can be None! one TB I saw had this problem:
# in the code block # it is a groupchat presence in handle_event_notify # in the code block # it is a groupchat presence in handle_event_notify
# jid was None. Yann why? # jid was None. Yann why?

View File

@ -1429,12 +1429,13 @@ class Interface:
def test_migration(migration): def test_migration(migration):
if not migration.PROCESSING: if not migration.PROCESSING:
dialog = gtk.Dialog() dialog = gtk.Dialog()
#FIXME: translate these strings after 0.9
dialog = gtk.MessageDialog(None, dialog = gtk.MessageDialog(None,
gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL, gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL,
gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, message_format = 'GUI Migration failed') gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
message_format = _('GUI Migration failed'))
dialog.format_secondary_text('Logs migration through graphical interface failed. The migration process will start in the background. Please wait a few minutes for Gajim to start.') dialog.format_secondary_text(
_('Logs migration through graphical interface failed. The migration process will start in the background. Please wait a few minutes for Gajim to start.'))
dialog.run() dialog.run()
dialog.destroy() dialog.destroy()
gtk.main_quit() gtk.main_quit()

View File

@ -356,14 +356,18 @@ class GroupchatWindow(chat.Chat):
if model.iter_n_children(parent_iter) == 0: if model.iter_n_children(parent_iter) == 0:
model.remove(parent_iter) model.remove(parent_iter)
def add_contact_to_roster(self, room_jid, nick, show, role, jid, affiliation, status): def add_contact_to_roster(self, room_jid, nick, show, role, affiliation, status, jid = ''):
model = self.list_treeview[room_jid].get_model() model = self.list_treeview[room_jid].get_model()
role_name = helpers.get_uf_role(role, plural = True) role_name = helpers.get_uf_role(role, plural = True)
resource = ''
if jid: if jid:
jid = jid.split('/', 1)[0] jids = jid.split('/', 1)
j = jids[0]
if len(jids) > 1:
resource = jids[1]
else: else:
jid = '' j = ''
name = nick name = nick
@ -376,7 +380,7 @@ class GroupchatWindow(chat.Chat):
if not nick in gajim.contacts.get_nick_list(self.account, room_jid): if not nick in gajim.contacts.get_nick_list(self.account, room_jid):
gc_contact = gajim.contacts.create_gc_contact(room_jid = room_jid, gc_contact = gajim.contacts.create_gc_contact(room_jid = room_jid,
name = nick, show = show, status = status, role = role, name = nick, show = show, status = status, role = role,
affiliation = affiliation, jid = jid) affiliation = affiliation, jid = j, resource = resource)
gajim.contacts.add_gc_contact(self.account, gc_contact) gajim.contacts.add_gc_contact(self.account, gc_contact)
self.draw_contact(room_jid, nick) self.draw_contact(room_jid, nick)
if nick == self.nicks[room_jid]: # we became online if nick == self.nicks[room_jid]: # we became online
@ -420,8 +424,8 @@ class GroupchatWindow(chat.Chat):
for nick in gajim.contacts.get_nick_list(self.account, room_jid): for nick in gajim.contacts.get_nick_list(self.account, room_jid):
gc_contact = gajim.contacts.get_gc_contact(self.account, room_jid, nick) gc_contact = gajim.contacts.get_gc_contact(self.account, room_jid, nick)
self.add_contact_to_roster(room_jid, nick, gc_contact.show, self.add_contact_to_roster(room_jid, nick, gc_contact.show,
gc_contact.role, gc_contact.jid, gc_contact.affiliation, gc_contact.role, gc_contact.affiliation, gc_contact.status,
gc_contact.status) gc_contact.jid)
def get_role(self, room_jid, nick): def get_role(self, room_jid, nick):
gc_contact = gajim.contacts.get_gc_contact(self.account, room_jid, nick) gc_contact = gajim.contacts.get_gc_contact(self.account, room_jid, nick)
@ -486,14 +490,14 @@ class GroupchatWindow(chat.Chat):
else: else:
iter = self.get_contact_iter(room_jid, nick) iter = self.get_contact_iter(room_jid, nick)
if not iter: if not iter:
iter = self.add_contact_to_roster(room_jid, nick, show, role, jid, iter = self.add_contact_to_roster(room_jid, nick, show, role,
affiliation, status) affiliation, status, jid)
else: else:
actual_role = self.get_role(room_jid, nick) actual_role = self.get_role(room_jid, nick)
if role != actual_role: if role != actual_role:
self.remove_contact(room_jid, nick) self.remove_contact(room_jid, nick)
self.add_contact_to_roster(room_jid, nick, show, role, jid, self.add_contact_to_roster(room_jid, nick, show, role,
affiliation, status) affiliation, status, jid)
else: else:
c = gajim.contacts.get_gc_contact(self.account, room_jid, nick) c = gajim.contacts.get_gc_contact(self.account, room_jid, nick)
if c.show == show and c.status == status and \ if c.show == show and c.status == status and \
@ -1155,17 +1159,11 @@ current room topic.') % command, room_jid)
def on_info(self, widget, room_jid, nick): def on_info(self, widget, room_jid, nick):
'''Call vcard_information_window class to display user's information''' '''Call vcard_information_window class to display user's information'''
c = gajim.contacts.get_gc_contact(self.account, room_jid, nick) c = gajim.contacts.get_gc_contact(self.account, room_jid, nick)
if c.jid and c.resource: jid = c.get_full_jid()
# on GC, we know resource only if we're mod and up
jid = c.jid
fjid = c.jid + '/' + c.resource
else:
fjid = gajim.construct_fjid(room_jid, nick)
jid = fjid
if gajim.interface.instances[self.account]['infos'].has_key(jid): if gajim.interface.instances[self.account]['infos'].has_key(jid):
gajim.interface.instances[self.account]['infos'][jid].window.present() gajim.interface.instances[self.account]['infos'][jid].window.present()
else: else:
# we copy contact because c.jid must contain the fakeJid for vcard # we create a Contact instance
c2 = gajim.contacts.contact_from_gc_contact(c) c2 = gajim.contacts.contact_from_gc_contact(c)
gajim.interface.instances[self.account]['infos'][jid] = \ gajim.interface.instances[self.account]['infos'][jid] = \
vcard.VcardWindow(c2, self.account, False) vcard.VcardWindow(c2, self.account, False)

View File

@ -56,7 +56,7 @@ def notify(event_type, jid, account, msg_type = '', file_props = None):
DesktopNotification(event_type, jid, account, msg_type, file_props) DesktopNotification(event_type, jid, account, msg_type, file_props)
return return
except dbus.dbus_bindings.DBusException, e: except dbus.dbus_bindings.DBusException, e:
# Connection to DBus failed, try popup # Connection to D-Bus failed, try popup
gajim.log.debug(str(e)) gajim.log.debug(str(e))
except TypeError, e: except TypeError, e:
# This means that we sent the message incorrectly # This means that we sent the message incorrectly
@ -112,12 +112,30 @@ class DesktopNotification:
actor = jid actor = jid
txt = actor # default value of txt txt = actor # default value of txt
transport_name = gajim.get_transport_name_from_jid(jid)
if transport_name in ('aim', 'icq', 'msn', 'yahoo'):
prefix = transport_name
else:
prefix = 'jabber'
'''
if transport_name == 'aim':
prefix = 'aim'
elif transport_name == 'icq':
prefix = 'icq'
elif transport_name == 'msn':
prefix = 'msn'
elif transport_name == 'yahoo':
prefix = 'yahoo'
else:
prefix = 'jabber'
'''
if event_type == _('Contact Signed In'): if event_type == _('Contact Signed In'):
img = 'contact_online.png' img = prefix + '_online.png'
ntype = 'presence.online' ntype = 'presence.online'
elif event_type == _('Contact Signed Out'): elif event_type == _('Contact Signed Out'):
img = 'contact_offline.png' img = prefix + '_offline.png'
ntype = 'presence.offline' ntype = 'presence.offline'
elif event_type in (_('New Message'), _('New Single Message'), elif event_type in (_('New Message'), _('New Single Message'),
_('New Private Message')): _('New Private Message')):

View File

@ -708,10 +708,15 @@ class RosterWindow:
contact.status = status contact.status = status
if show in ('offline', 'error') and \ if show in ('offline', 'error') and \
not gajim.awaiting_events[account].has_key(contact.jid): not gajim.awaiting_events[account].has_key(contact.jid):
if len(contact_instances) > 1 or not showOffline: if len(contact_instances) > 1:
# if multiple resources or we don't show offline contacts # if multiple resources
gajim.contacts.remove_contact(account, contact) gajim.contacts.remove_contact(account, contact)
self.draw_contact(contact.jid, account) self.draw_contact(contact.jid, account)
elif not showOffline:
# we don't show offline contacts
self.remove_contact(contact, account)
else:
self.draw_contact(contact.jid, account)
else: else:
if not self.get_contact_iter(contact.jid, account): if not self.get_contact_iter(contact.jid, account):
self.add_contact_to_roster(contact.jid, account) self.add_contact_to_roster(contact.jid, account)
@ -2500,7 +2505,9 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
# user1.groups # user1.groups
c = gajim.contacts.get_first_contact_from_jid(account, data) c = gajim.contacts.get_first_contact_from_jid(account, data)
if context.action != gtk.gdk.ACTION_COPY: if context.action != gtk.gdk.ACTION_COPY:
c.groups.remove(grp_source) if grp_source in c.groups:
# Make sure contact was in a group
c.groups.remove(grp_source)
if model.iter_n_children(iter_group_source) == 1: if model.iter_n_children(iter_group_source) == 1:
# this was the only child # this was the only child
model.remove(iter_group_source) model.remove(iter_group_source)

View File

@ -452,8 +452,7 @@ class VcardWindow:
def change_to_vcard(self): def change_to_vcard(self):
self.xml.get_widget('information_notebook').remove_page(0) self.xml.get_widget('information_notebook').remove_page(0)
#FIXME: make this string translatable for .10 [thanks Stian] self.xml.get_widget('nickname_label').set_text(_('Personal details'))
self.xml.get_widget('nickname_label').set_text('Personal details')
self.publish_button.show() self.publish_button.show()
self.retrieve_button.show() self.retrieve_button.show()