Changeset 8955

Show
Ignore:
Timestamp:
11/09/07 20:30:15 (11 months ago)
Author:
asterix
Message:

merge some fixes from trunk: [8864] [8866] [8881] [8884] [8887] [8894] [8895] [8902] [8903] [8904] [8905] [8906] [8910] [8918] [8919] [8921] [8923] [8924] [8938] [8942] [8952] [8953] [8954]

Location:
branches/gajim_0.11.2/src
Files:
17 modified

Legend:

Unmodified
Added
Removed
  • branches/gajim_0.11.2/src/adhoc_commands.py

    r8745 r8955  
    446446                        # commands => command selection stage 
    447447                        query = response.getTag('query') 
    448                         if query: 
     448                        if query and query.getAttr('node') == xmpp.NS_COMMANDS: 
    449449                                items = query.getTags('item') 
    450450                        else: 
  • branches/gajim_0.11.2/src/cell_renderer_image.py

    r6980 r8955  
    9090                if self.image.get_storage_type() == gtk.IMAGE_ANIMATION: 
    9191                        if self.image not in self.iters: 
     92                                if not isinstance(widget, gtk.TreeView): 
     93                                        return 
    9294                                animation = self.image.get_animation() 
    9395                                iter =  animation.get_iter() 
  • branches/gajim_0.11.2/src/chat_control.py

    r8709 r8955  
    17981798                window.set_events(gtk.gdk.POINTER_MOTION_MASK) 
    17991799                window.set_app_paintable(True) 
     1800                if gtk.gtk_version >= (2, 10, 0) and gtk.pygtk_version >= (2, 10, 0): 
     1801                        window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLTIP) 
    18001802                 
    18011803                window.realize() 
  • branches/gajim_0.11.2/src/common/commands.py

    r8632 r8955  
    259259                jid = helpers.get_full_jid_from_iq(iq_obj) 
    260260                q = iq.getTag('query') 
     261                # buildReply don't copy the node attribute. Re-add it 
     262                q.setAttr('node', xmpp.NS_COMMANDS) 
    261263 
    262264                for node, cmd in self.__commands.iteritems(): 
  • branches/gajim_0.11.2/src/common/connection_handlers.py

    r8740 r8955  
    449449 
    450450                if real_id[:3] == 'au_': 
    451                         gajim.socks5queue.send_file(file_props, self.name) 
     451                        if file.has_key('stopped') and file_props['stopped']: 
     452                                self.remove_transfer(file_props) 
     453                        else: 
     454                                gajim.socks5queue.send_file(file_props, self.name) 
    452455                        raise common.xmpp.NodeProcessed 
    453456 
     
    471474 
    472475                else: 
    473                         gajim.socks5queue.send_file(file_props, self.name) 
     476                        if file_props.has_key('stopped') and file_props['stopped']: 
     477                                self.remove_transfer(file_props) 
     478                        else: 
     479                                gajim.socks5queue.send_file(file_props, self.name) 
    474480                        if file_props.has_key('fast'): 
    475481                                fasts = file_props['fast'] 
     
    10441050                                self.dispatch('METACONTACTS', meta_list) 
    10451051                        else: 
    1046                                 self.private_storage_supported = False 
     1052                                if iq_obj.getErrorCode() not in ('403', '406', '404'): 
     1053                                        self.private_storage_supported = False 
    10471054                        # We can now continue connection by requesting the roster 
    10481055                        self.connection.initRoster() 
  • branches/gajim_0.11.2/src/common/xmpp/roster.py

    r3112 r8955  
    6565        """ Subscription tracker. Used internally for setting items state in 
    6666            internal roster representation. """ 
     67        sender = stanza.getAttr('from') 
     68        if not sender == None: and not sender.bareMatch( 
     69        self._owner.User + '@' + self._owner.Server): 
     70            return 
    6771        for item in stanza.getTag('query').getTags('item'): 
    6872            jid=item.getAttr('jid') 
  • branches/gajim_0.11.2/src/common/zeroconf/client_zeroconf.py

    r8716 r8955  
    213213        def on_disconnect(self): 
    214214                if self.conn_holder: 
    215                         if self.conn_holder.number_of_awaiting_messages.has_key(self.conn_holder.fd): 
    216                                 if self.conn_holder.number_of_awaiting_messages[self.conn_holder.fd] > 0: 
     215                        if self.conn_holder.number_of_awaiting_messages.has_key(self.fd): 
     216                                if self.conn_holder.number_of_awaiting_messages[self.fd] > 0: 
    217217                                        self._caller.dispatch('MSGERROR',[unicode(self.to), -1, \ 
    218218                                        _('Connection to host could not be established'), None, None]) 
    219                                 del self.conn_holder.number_of_awaiting_messages[self.conn_holder.fd] 
     219                                del self.conn_holder.number_of_awaiting_messages[self.fd] 
    220220                        self.conn_holder.remove_connection(self.sock_hash)  
    221221                if self.__dict__.has_key('Dispatcher'): 
  • branches/gajim_0.11.2/src/common/zeroconf/connection_handlers_zeroconf.py

    r8699 r8955  
    582582                file_props['request-id'] = unicode(iq_obj.getAttr('id')) 
    583583                file_props['sid'] = unicode(si.getAttr('id')) 
     584                file_props['transfered_size'] = [] 
    584585                gajim.socks5queue.add_file_props(self.name, file_props) 
    585586                self.dispatch('FILE_REQUEST', (jid, file_props)) 
  • branches/gajim_0.11.2/src/dialogs.py

    r8840 r8955  
    23922392                        on_response_cancel = on_response_cancel) 
    23932393 
     2394                if on_response_cancel: 
     2395                        self.connect('destroy', on_response_cancel) 
     2396 
    23942397                filter = gtk.FileFilter() 
    23952398                filter.set_name(_('All files')) 
  • branches/gajim_0.11.2/src/disco.py

    r8691 r8955  
    6666                ('server', 'im'):                               (ToplevelAgentBrowser, 'jabber.png'), 
    6767                ('services', 'jabber'):         (ToplevelAgentBrowser, 'jabber.png'), 
     68                ('hierarchy', 'branch'):        (AgentBrowser, 'jabber.png'), 
    6869 
    6970                # Services 
     
    7879                ('pubsub', 'service'):          (PubSubBrowser, 'pubsub.png'), 
    7980                ('proxy', 'bytestreams'):       (None, 'bytestreams.png'), # Socks5 FT proxy 
     81                ('headline', 'newmail'):        (ToplevelAgentBrowser, 'mail.png'), 
    8082 
    8183                # Transports 
     
    960962                self.model.append((jid, node, item.get('name', ''), 
    961963                        get_agent_address(jid, node))) 
     964                self.cache.get_info(jid, node, self._agent_info, force = force) 
    962965 
    963966        def _update_item(self, iter, jid, node, item): 
     
    970973                '''Called when an item should be updated in the model with further info. 
    971974                The result of a disco#info query.''' 
    972                 self.model[iter][2] = identities[0].get('name', '') 
     975                name = identities[0].get('name', '') 
     976                if name: 
     977                        self.model[iter][2] = name 
    973978 
    974979        def _update_error(self, iter, jid, node): 
  • branches/gajim_0.11.2/src/gajim.py

    r8878 r8955  
    2424from common import i18n 
    2525 
     26# PyGTK2.10+ only throws a warning 
     27import warnings 
     28warnings.filterwarnings('error', module='gtk') 
     29try: 
     30        import gtk 
     31except Warning, msg: 
     32        if str(msg) == 'could not open display': 
     33                print >> sys.stderr, _('Gajim needs X server to run. Quiting...') 
     34                sys.exit() 
     35warnings.resetwarnings() 
     36 
    2637import message_control 
    2738 
     
    4152                pass 
    4253 
    43 try: 
    44         import gtk 
    45 except RuntimeError, msg: 
    46         if str(msg) == 'could not open display': 
    47                 print >> sys.stderr, _('Gajim needs X server to run. Quiting...') 
    48                 sys.exit() 
    4954pritext = '' 
    5055if gtk.pygtk_version < (2, 6, 0): 
     
    10211026                if self.msg_win_mgr.has_window(fjid, account): 
    10221027                        ctrl = self.msg_win_mgr.get_control(fjid, account) 
    1023                         contact = ctrl.contact 
    1024                         contact.show = show 
    1025                         contact.status = status 
    1026                         ctrl.update_ui() 
    1027                         uf_show = helpers.get_uf_show(show) 
    1028                         if status: 
    1029                                 ctrl.print_conversation(_('%s is now %s (%s)') % (nick, uf_show, 
    1030                                         status), 'status') 
     1028                        statusCode = array[9] 
     1029                        if '303' in statusCode: 
     1030                                new_nick = array[10] 
     1031                                ctrl.print_conversation(_('%s is now known as %s') % (nick, 
     1032                                        new_nick), 'status') 
     1033                                gc_c = gajim.contacts.get_gc_contact(account, room_jid, new_nick) 
     1034                                c = gajim.contacts.contact_from_gc_contact(gc_c) 
     1035                                ctrl.gc_contact = gc_c 
     1036                                ctrl.contact = c 
     1037                                ctrl.draw_banner() 
     1038                                old_jid = room_jid + '/' + nick 
     1039                                new_jid = room_jid + '/' + new_nick 
     1040                                self.msg_win_mgr.change_key(old_jid, new_jid, account) 
    10311041                        else: 
    1032                                 ctrl.print_conversation(_('%s is now %s') % (nick, uf_show), 
    1033                                         'status') 
    1034                         ctrl.parent_win.redraw_tab(ctrl) 
     1042                                contact = ctrl.contact 
     1043                                contact.show = show 
     1044                                contact.status = status 
     1045                                uf_show = helpers.get_uf_show(show) 
     1046                                if status: 
     1047                                        ctrl.print_conversation(_('%s is now %s (%s)') % (nick, uf_show, 
     1048                                                status), 'status') 
     1049                                else: 
     1050                                        ctrl.print_conversation(_('%s is now %s') % (nick, uf_show), 
     1051                                                'status') 
     1052                                ctrl.parent_win.redraw_tab(ctrl) 
     1053                                ctrl.update_ui() 
    10351054                        if self.remote_ctrl: 
    10361055                                self.remote_ctrl.raise_signal('GCPresence', (account, array)) 
  • branches/gajim_0.11.2/src/groupchat_control.py

    r8937 r8955  
    187187 
    188188                self.room_jid = self.contact.jid 
    189                 self.nick = contact.name 
     189                self.nick = contact.name.decode('utf-8') 
     190                self.new_nick = '' 
    190191                self.name = self.room_jid.split('@')[0] 
    191192 
     
    868869                                self.print_conversation(s, 'info') 
    869870                        elif '303' in statusCode: # Someone changed his or her nick 
    870                                 if nick == self.nick: # We changed our nick 
    871                                         self.nick = new_nick 
     871                                if nick == self.new_nick: # We changed our nick 
     872                                        self.nick = self.new_nick 
     873                                        self.new_nick = '' 
    872874                                        s = _('You are now known as %s') % new_nick 
    873875                                else: 
     
    896898                                                os.path.join(path, puny_new_nick + ext) 
    897899                                for old_file in files: 
    898                                         if os.path.exists(old_file): 
     900                                        if os.path.exists(old_file) and old_file != files[old_file]: 
    899901                                                if os.path.exists(files[old_file]): 
    900902                                                        # Windows require this 
     
    11071109                                        return True 
    11081110                                gajim.connections[self.account].join_gc(nick, self.room_jid, None) 
     1111                                self.new_nick = nick 
    11091112                                self.clear(self.msg_textview) 
    11101113                        else: 
     
    13891392                        gajim.connections[self.account].join_gc(nick, self.room_jid, None) 
    13901393                        self.nick = nick 
     1394 
    13911395                instance = dialogs.InputDialog(title, prompt, proposed_nick, 
    13921396                        is_modal = False, ok_handler = on_ok) 
  • branches/gajim_0.11.2/src/message_window.py

    r8693 r8955  
    439439                        nth_child = notebook.get_nth_page(page_num) 
    440440                        return self._widget_to_control(nth_child) 
     441 
     442        def change_key(self, old_jid, new_jid, acct): 
     443                '''Change the key of a control''' 
     444                try: 
     445                        # Check if control exists 
     446                        ctrl = self._controls[acct][old_jid] 
     447                except: 
     448                        return 
     449                self._controls[acct][new_jid] = self._controls[acct][old_jid] 
     450                del self._controls[acct][old_jid] 
    441451 
    442452        def controls(self): 
     
    767777                return win 
    768778 
     779        def change_key(self, old_jid, new_jid, acct): 
     780                win = self.get_window(old_jid, acct) 
     781                if self.mode == self.ONE_MSG_WINDOW_NEVER: 
     782                        old_key = acct + old_jid 
     783                        if old_jid not in self._windows: 
     784                                return 
     785                        new_key = acct + new_jid 
     786                        self._windows[new_key] = self._windows[old_key] 
     787                        del self._windows[old_key] 
     788                win.change_key(old_jid, new_jid, acct) 
     789 
    769790        def _on_window_delete(self, win, event): 
    770791                self.save_state(self._gtk_win_to_msg_win(win)) 
  • branches/gajim_0.11.2/src/profile_window.py

    r7940 r8955  
    6767                self.jid = gajim.get_jid_from_account(account) 
    6868 
     69                self.dialog = None 
    6970                self.avatar_mime_type = None 
    7071                self.avatar_encoded = None 
     
    99100                        gobject.source_remove(self.remove_statusbar_timeout_id) 
    100101                del gajim.interface.instances[self.account]['profile'] 
     102                if self.dialog: # Image chooser dialog 
     103                        self.dialog.destroy() 
    101104 
    102105        def on_profile_window_key_press_event(self, widget, event): 
     
    156159                        # rescale it 
    157160                        pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'vcard') 
     161                        self.dialog = None 
    158162                        button = self.xml.get_widget('PHOTO_button') 
    159163                        image = button.get_image() 
     
    173177                def on_clear(widget): 
    174178                        self.dialog.destroy() 
     179                        self.dialog = None 
    175180                        self.on_clear_button_clicked(widget) 
    176181 
    177                 self.dialog = dialogs.AvatarChooserDialog(on_response_ok = on_ok, 
    178                         on_response_clear = on_clear) 
     182                def on_cancel(widget): 
     183                        self.dialog.destroy() 
     184                        self.dialog = None 
     185 
     186                if self.dialog: 
     187                        self.dialog.present() 
     188                else: 
     189                        self.dialog = dialogs.AvatarChooserDialog(on_response_ok = on_ok, 
     190                                on_response_cancel = on_cancel, on_response_clear = on_clear) 
    179191 
    180192        def on_PHOTO_button_press_event(self, widget, event): 
  • branches/gajim_0.11.2/src/roster_window.py

    r8950 r8955  
    27172717                                jids 
    27182718                        self.dialog = dialogs.ConfirmationDialog(pritext, sectext, 
    2719                                 on_response_ok = (on_ok, list_)) 
     2719                                on_response_ok = (on_ok2, list_)) 
    27202720 
    27212721 
  • branches/gajim_0.11.2/src/systray.py

    r7510 r8955  
    317317                        'CHANGE_STATUS_MSG_MENUITEM', 'SEPARATOR', 'offline'] 
    318318                index = l.index(show) 
    319                 gajim.interface.roster.status_combobox.set_active(index) 
     319                current = gajim.interface.roster.status_combobox.get_active() 
     320                if index != current: 
     321                        gajim.interface.roster.status_combobox.set_active(index) 
     322                else: 
     323                        # We maybe need to emit the changed signal if all globaly sync'ed 
     324                        # account don't have the global status 
     325                        need_to_change = False 
     326                        accounts = gajim.connections.keys() 
     327                        for acct in accounts: 
     328                                if not gajim.config.get_per('accounts', acct, 
     329                                'sync_with_global_status'): 
     330                                        continue 
     331                                acct_show = gajim.SHOW_LIST[gajim.connections[acct].connected] 
     332                                if acct_show != show: 
     333                                        need_to_change = True 
     334                                        break 
     335                        if need_to_change: 
     336                                gajim.interface.roster.status_combobox.emit('changed') 
    320337 
    321338        def on_change_status_message_activate(self, widget): 
  • branches/gajim_0.11.2/src/tooltips.py

    r7940 r8955  
    6464                self.win.set_resizable(False) 
    6565                self.win.set_name('gtk-tooltips') 
     66                if gtk.gtk_version >= (2, 10, 0) and gtk.pygtk_version >= (2, 10, 0): 
     67                        self.win.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLTIP) 
    6668                 
    6769                self.win.set_events(gtk.gdk.POINTER_MOTION_MASK)