Show
Ignore:
Timestamp:
01/13/07 23:35:41 (20 months ago)
Author:
asterix
Message:

merge diff from trunc to 0.11 branch

Location:
branches/gajim_0.11/src
Files:
28 modified

Legend:

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

    r7662 r7829  
    267267                if self.data_form_widget.get_data_form() is None: 
    268268                        self.data_form_widget.hide() 
     269                else: 
     270                        self.data_form_widget.data_form.type='submit' 
    269271 
    270272                self.close_button.set_sensitive(True) 
     
    297299                                # FIXME: translate 
    298300                                self.stage5(error='Service sent malformed data', senderror=True) 
     301                                return 
    299302                        self.data_form_widget.show() 
     303                        if self.data_form_widget.title: 
     304                                self.window.set_title("%s - Ad-hoc Commands - Gajim" % \ 
     305                                        self.data_form_widget.title) 
    300306                else: 
    301307                        self.data_form_widget.hide() 
     
    466472#                       cmdnode.addChild(node=dataforms.DataForm(tofill=self.data_form_widget.data_form)) 
    467473                        # FIXME: simplified form to send 
     474                         
    468475                        cmdnode.addChild(node=self.data_form_widget.data_form) 
    469476 
     
    481488                '''Send the command with action='cancel'. ''' 
    482489                assert self.commandnode is not None 
    483                 if self.sessionid is not None: 
     490                if self.sessionid is not None and self.account.connection: 
    484491                        # we already have sessionid, so the service sent at least one reply. 
    485492                        stanza = xmpp.Iq(typ='set', to=self.jid) 
     
    490497                                        'action':'cancel' 
    491498                                }) 
    492          
     499 
    493500                        self.account.connection.send(stanza) 
    494501                else: 
  • branches/gajim_0.11/src/chat_control.py

    r7787 r7829  
    9292 
    9393        def draw_banner(self): 
    94                 self._paint_banner() 
     94                '''Draw the fat line at the top of the window that  
     95                houses the icon, jid, ...  
     96                ''' 
     97                self.draw_banner_text() 
    9598                self._update_banner_state_image() 
    96                 # Derived types SHOULD implement this 
     99                # Derived types MAY implement this 
     100 
     101        def draw_banner_text(self): 
     102                pass # Derived types SHOULD implement this 
    97103 
    98104        def update_ui(self): 
     
    101107 
    102108        def repaint_themed_widgets(self): 
     109                self._paint_banner() 
    103110                self.draw_banner() 
    104111                # Derived classes MAY implement this 
     
    209216                self.style_event_id = 0 
    210217                self.conv_textview.tv.show() 
     218                self._paint_banner() 
    211219 
    212220                # For JEP-0172 
     
    850858                self.handlers[id] = widget 
    851859 
    852                 self.hide_chat_buttons_always = gajim.config.get( 
     860                hide_chat_buttons_always = gajim.config.get( 
    853861                        'always_hide_chat_buttons') 
    854                 self.chat_buttons_set_visible(self.hide_chat_buttons_always) 
     862                self.chat_buttons_set_visible(hide_chat_buttons_always) 
    855863                self.widget_set_visible(self.xml.get_widget('banner_eventbox'), 
    856864                        gajim.config.get('hide_chat_banner')) 
     
    10121020                self._update_gpg() 
    10131021 
    1014         def draw_banner(self, chatstate = None): 
    1015                 '''Draw the fat line at the top of the window that  
    1016                 houses the status icon, name, jid.  The chatstate arg should 
    1017                 only be used if the control's chatstate member is NOT to be use, such as 
    1018                 composing, paused, etc. 
     1022        def draw_banner_text(self): 
     1023                '''Draw the text in the fat line at the top of the window that  
     1024                houses the name, jid.  
    10191025                ''' 
    1020                 ChatControlBase.draw_banner(self) 
    1021  
    10221026                contact = self.contact 
    10231027                jid = contact.jid 
     
    10711075                                else: 
    10721076                                        chatstate = '' 
    1073                         elif chatstate is None: 
     1077                        else: 
     1078                                # When does that happen ? See [7797] and [7804] 
    10741079                                chatstate = helpers.get_uf_chatstate(cs) 
    10751080 
     
    15521557        def handle_incoming_chatstate(self): 
    15531558                ''' handle incoming chatstate that jid SENT TO us ''' 
    1554                 self.draw_banner() 
     1559                self.draw_banner_text() 
    15551560                # update chatstate in tab for this chat 
    15561561                self.parent_win.redraw_tab(self, self.contact.chatstate) 
     
    16501655                                        constants.KIND_CHAT_MSG_RECV): 
    16511656                                kind = 'incoming' 
     1657                                name = self.contact.get_shown_name() 
     1658                        elif row[1] == constants.KIND_ERROR: 
     1659                                kind = 'status' 
    16521660                                name = self.contact.get_shown_name() 
    16531661 
  • branches/gajim_0.11/src/common/commands.py

    r7669 r7829  
    129129                cmd.addChild('note', {}, 'The status has been changed.') 
    130130 
    131                 self.connection.connection.send(response) 
     131                # if going offline, we need to push response so it won't go into 
     132                # queue and disappear 
     133                self.connection.connection.send(response, presencetype=='offline') 
    132134 
    133135                # send new status 
  • branches/gajim_0.11/src/common/config.py

    r7787 r7829  
    131131                'latest_disco_addresses': [ opt_str, '' ], 
    132132                'recently_groupchat': [ opt_str, '' ], 
    133                 'before_time': [ opt_str, '[' ], 
    134                 'after_time': [ opt_str, ']' ], 
    135133                'before_nickname': [ opt_str, '' ], 
     134                'time_stamp': [ opt_str, '[%H:%M] ' ], 
    136135                'after_nickname': [ opt_str, ':' ], 
    137136                'send_os_info': [ opt_bool, True ], 
  • branches/gajim_0.11/src/common/connection_handlers.py

    r7787 r7829  
    2525import sys 
    2626 
    27 from time import localtime, strftime, gmtime, timezone 
     27from time import localtime, strftime, gmtime 
    2828from calendar import timegm 
    2929 
     
    887887                c = f.read() 
    888888                f.close() 
    889                 card = common.xmpp.Node(node = c) 
     889                try: 
     890                        card = common.xmpp.Node(node = c) 
     891                except: 
     892                        # We are unable to parse it. Remove it 
     893                        os.remove(path_to_file) 
     894                        return None 
    890895                vcard = self.node_to_dict(card) 
    891896                if vcard.has_key('PHOTO'): 
  • branches/gajim_0.11/src/common/connection.py

    r7634 r7829  
    8080                self.continue_connect_info = None 
    8181                if USE_GPG: 
    82                         self.gpg = GnuPG.GnuPG() 
     82                        self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) 
    8383                        gajim.config.set('usegpg', True) 
    8484                else: 
     
    197197                                                self.password = self.new_account_info['password'] 
    198198                                                if USE_GPG: 
    199                                                         self.gpg = GnuPG.GnuPG() 
     199                                                        self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) 
    200200                                                        gajim.config.set('usegpg', True) 
    201201                                                else: 
     
    489489                if not self.connection: 
    490490                        return 
    491                 common.xmpp.features_nb.delPrivacyList(self.connection, privacy_list) 
     491                def _on_del_privacy_list_result(result): 
     492                        if result: 
     493                                self.dispatch('PRIVACY_LIST_REMOVED', privacy_list) 
     494                        else: 
     495                                self.dispatch('ERROR', (_('Error while removing privacy list'), 
     496                                        _('Privacy list %s has not been removed. It is maybe active in ' 
     497                                        'one of your connected resources. Desactivate it and try ' 
     498                                        'again.') % privacy_list)) 
     499                common.xmpp.features_nb.delPrivacyList(self.connection, privacy_list, 
     500                        _on_del_privacy_list_result) 
    492501         
    493502        def get_privacy_list(self, title): 
     
    10411050                        t.setTagData('password', password) 
    10421051                self.connection.send(p) 
     1052 
    10431053                #last date/time in history to avoid duplicate 
    1044                 last_log = gajim.logger.get_last_date_that_has_logs(room_jid, 
    1045                         is_room = True) 
    1046                 if last_log is None: 
    1047                         last_log = 0 
    1048                 self.last_history_line[room_jid]= last_log 
     1054                if not self.last_history_line.has_key(room_jid):  
     1055                        # Not in memory, get it from DB 
     1056                        last_log = gajim.logger.get_last_date_that_has_logs(room_jid, 
     1057                                is_room = True) 
     1058                        if last_log is None: 
     1059                                last_log = 0 
     1060                        self.last_history_line[room_jid]= last_log 
    10491061 
    10501062        def send_gc_message(self, jid, msg, xhtml = None): 
     
    10911103                # disconnect from jabber server 
    10921104                self.connection.send(p) 
     1105                # Save the time we quit to avoid duplicate logs AND be faster than  
     1106                # get that date from DB 
     1107                self.last_history_line[jid] = time.time() 
    10931108 
    10941109        def gc_set_role(self, room_jid, nick, role, reason = ''): 
  • branches/gajim_0.11/src/common/dataforms.py

    r7500 r7829  
    342342                def fget(self): 
    343343                        return self.getAttr('type') 
    344                 def fset(self): 
     344                def fset(self, type): 
    345345                        assert type in ('form', 'submit', 'cancel', 'result') 
    346346                        self.setAttr('type', type) 
  • branches/gajim_0.11/src/common/defs.py

    r7684 r7829  
    33datadir = '../' 
    44 
    5 version = '0.11' 
     5version = '0.11.0.1' 
    66 
    77import sys, os.path 
  • branches/gajim_0.11/src/common/GnuPG.py

    r7652 r7829  
    4444 
    4545        class GnuPG(GnuPGInterface.GnuPG): 
    46                 def __init__(self): 
     46                def __init__(self, use_agent = False): 
    4747                        GnuPGInterface.GnuPG.__init__(self) 
     48                        self.use_agent = use_agent 
    4849                        self._setup_my_options() 
    4950 
     
    5455                        # Nolith's patch - prevent crashs on non fully-trusted keys 
    5556                        self.options.extra_args.append('--always-trust') 
     57                        if self.use_agent: 
     58                                self.options.extra_args.append('--use-agent') 
    5659 
    5760                def _read_response(self, child_stdout): 
  • branches/gajim_0.11/src/common/logger.py

    r7787 r7829  
    426426                self.cur.execute(''' 
    427427                        SELECT time, kind, message FROM logs 
    428                         WHERE (%s) AND kind IN (%d, %d, %d, %d) AND time > %d 
     428                        WHERE (%s) AND kind IN (%d, %d, %d, %d, %d) AND time > %d 
    429429                        ORDER BY time DESC LIMIT %d OFFSET %d 
    430                         ''' % (where_sql, constants.KIND_SINGLE_MSG_RECV, constants.KIND_CHAT_MSG_RECV, 
    431                                 constants.KIND_SINGLE_MSG_SENT, constants.KIND_CHAT_MSG_SENT, 
     430                        ''' % (where_sql, constants.KIND_SINGLE_MSG_RECV, 
     431                                constants.KIND_CHAT_MSG_RECV, constants.KIND_SINGLE_MSG_SENT, 
     432                                constants.KIND_CHAT_MSG_SENT, constants.KIND_ERROR, 
    432433                                timed_out, restore_how_many_rows, pending_how_many) 
    433434                        ) 
     
    516517                result = self.cur.fetchall() 
    517518 
    518                 # Copy all interesant time in a temporary table  
     519                # Copy all interesting times in a temporary table  
    519520                self.cur.execute('CREATE TEMPORARY TABLE blabla(time,INTEGER)')  
    520521                for line in result:  
     
    555556                        where_sql = 'jid_id = %s' % jid_id       
    556557                self.cur.execute(''' 
    557                         SELECT time FROM logs 
     558                        SELECT MAX(time) FROM logs 
    558559                        WHERE (%s)  
    559560                        AND kind NOT IN (%d, %d) 
    560                         ORDER BY time DESC LIMIT 1 
    561561                        ''' % (where_sql, constants.KIND_STATUS, constants.KIND_GCSTATUS)) 
    562562 
  • branches/gajim_0.11/src/common/optparser.py

    r7787 r7829  
    1414 
    1515import os 
    16 import sys 
    1716import locale 
    1817from common import gajim 
     
    151150                if old < [0, 10, 1, 8] and new >= [0, 10, 1, 8]: 
    152151                        self.update_config_to_01018() 
     152                if old < [0, 11, 0, 1] and new >= [0, 11, 0, 1]: 
     153                        self.update_config_to_01101() 
    153154 
    154155                gajim.logger.init_vars() 
     
    368369                                 self.old_values['chat_state_notifications']) 
    369370                gajim.config.set('version', '0.10.1.8') 
     371 
     372        def update_config_to_01101(self): 
     373                '''fill time_stamp from before_time and after_time''' 
     374                if self.old_values.has_key('before_time'): 
     375                        gajim.config.set('time_stamp', '%s%%H:%%M%s ' % ( 
     376                                self.old_values['before_time'], self.old_values['after_time'])) 
     377                gajim.config.set('version', '0.11.0.1') 
  • branches/gajim_0.11/src/common/passwords.py

    r7787 r7829  
    1414 
    1515__all__ = ['get_password', 'save_password'] 
    16  
    17 import gobject 
    1816 
    1917from common import gajim 
  • branches/gajim_0.11/src/common/sleepy.py

    r7787 r7829  
    22## 
    33## Contributors for this file: 
    4 ##      - Yann Le Boulanger <asterix@lagaule.org> 
    5 ##      - Nikos Kouremenos <kourem@gmail.com> 
     4##        - Yann Le Boulanger <asterix@lagaule.org> 
     5##        - Nikos Kouremenos <kourem@gmail.com> 
    66## 
    77## Copyright (C) 2003-2004 Yann Le Boulanger <asterix@lagaule.org> 
    8 ##                        Vincent Hanquez <tab@snarc.org> 
     8##                                              Vincent Hanquez <tab@snarc.org> 
    99## Copyright (C) 2005-2006 Yann Le Boulanger <asterix@lagaule.org> 
    10 ##                    Nikos Kouremenos <kourem@gmail.com> 
     10##                                      Nikos Kouremenos <kourem@gmail.com> 
    1111## 
    1212## This program is free software; you can redistribute it and/or modify 
     
    2727STATE_XA   = 'extended away' 
    2828STATE_AWAY   = 'away' 
    29 STATE_AWAKE    = 'awake' 
     29STATE_AWAKE     = 'awake' 
    3030 
    3131SUPPORTED = True 
    3232try: 
    33         if os.name == 'nt': 
    34                 import ctypes 
     33                if os.name == 'nt': 
     34                        import ctypes 
    3535 
    36                 GetTickCount = ctypes.windll.kernel32.GetTickCount 
    37                 GetLastInputInfo = ctypes.windll.user32.GetLastInputInfo 
     36                        GetTickCount = ctypes.windll.kernel32.GetTickCount 
     37                        GetLastInputInfo = ctypes.windll.user32.GetLastInputInfo 
    3838 
    39                 class LASTINPUTINFO(ctypes.Structure): 
    40                         _fields_ = [('cbSize', ctypes.c_uint), 
    41                             ('dwTime', ctypes.c_uint)] 
     39                        class LASTINPUTINFO(ctypes.Structure): 
     40                                _fields_ = [('cbSize', ctypes.c_uint), ('dwTime', ctypes.c_uint)] 
    4241 
    43                 lastInputInfo = LASTINPUTINFO() 
    44                 lastInputInfo.cbSize = ctypes.sizeof(lastInputInfo) 
     42                        lastInputInfo = LASTINPUTINFO() 
     43                        lastInputInfo.cbSize = ctypes.sizeof(lastInputInfo) 
    4544 
    46         else: # unix 
    47                 import idle 
     45                else: # unix 
     46                        import idle 
    4847except: 
    4948        gajim.log.debug('Unable to load idle module') 
     
    5150 
    5251class SleepyWindows: 
    53         def __init__(self, away_interval = 60, xa_interval = 120): 
     52        def __init__(self, away_interval = 60, xa_interval = 120): 
    5453                self.away_interval = away_interval 
    5554                self.xa_interval = xa_interval 
    5655                self.state = STATE_AWAKE # assume we are awake 
    5756 
    58         def getIdleSec(self): 
    59                 GetLastInputInfo(ctypes.byref(lastInputInfo)) 
    60                 idleDelta = float(GetTickCount() - lastInputInfo.dwTime) / 1000 
    61                 return idleDelta 
     57        def getIdleSec(self): 
     58                GetLastInputInfo(ctypes.byref(lastInputInfo)) 
     59                idleDelta = float(GetTickCount() - lastInputInfo.dwTime) / 1000 
     60                return idleDelta 
    6261 
    6362        def poll(self): 
    6463                '''checks to see if we should change state''' 
     64                if not SUPPORTED: 
     65                        return False 
     66 
    6567                idleTime = self.getIdleSec() 
    66                  
     68 
    6769                # xa is stronger than away so check for xa first 
    6870                if idleTime > self.xa_interval: 
     
    8183 
    8284class SleepyUnix: 
    83  
    8485        def __init__(self, away_interval = 60, xa_interval = 120): 
    8586                self.away_interval = away_interval 
     
    9293                        self.state = STATE_UNKNOWN 
    9394 
    94         def getIdleSec(self): 
    95                 return idle.getIdleSec() 
     95        def getIdleSec(self): 
     96                return idle.getIdleSec() 
    9697 
    9798        def poll(self): 
     
    101102 
    102103                idleTime = self.getIdleSec() 
    103                  
     104 
    104105                # xa is stronger than away so check for xa first 
    105106                if idleTime > self.xa_interval: 
     
    118119 
    119120if os.name == 'nt': 
    120         Sleepy = SleepyWindows 
     121        Sleepy = SleepyWindows 
    121122else: 
    122         Sleepy = SleepyUnix 
     123        Sleepy = SleepyUnix 
  • branches/gajim_0.11/src/common/xmpp/features_nb.py

    r7521 r7829  
    250250        _on_default_response(disp, iq, None) 
    251251 
    252 def delPrivacyList(disp,listname): 
     252def delPrivacyList(disp,listname,cb=None): 
    253253        """ Deletes privacy list 'listname'. Returns true on success.""" 
    254254        iq = Iq('set',NS_PRIVACY,payload=[Node('list',{'name':listname})]) 
    255         _on_default_response(disp, iq, None) 
     255        _on_default_response(disp, iq, cb) 
  • branches/gajim_0.11/src/config.py

    r7787 r7829  
    241241                        self.xml.get_widget('time_always_radiobutton').set_active(True) 
    242242 
    243                 # before time 
    244                 st = gajim.config.get('before_time') 
     243                # TimeStamp 
     244                st = gajim.config.get('time_stamp') 
    245245                st = helpers.from_one_line(st) 
    246                 self.xml.get_