Daniel Brötzmann pushed to branch mainwindow at gajim / gajim

Commits:

8 changed files:

Changes:

  • data/org.gajim.Gajim.desktop.in
    ... ... @@ -13,7 +13,7 @@ X-GNOME-UsesNotifications=true
    13 13
     Terminal=false
    
    14 14
     Type=Application
    
    15 15
     MimeType=x-scheme-handler/xmpp;
    
    16
    -Actions=StartChat;ShowNextPendingEvent;
    
    16
    +Actions=StartChat;
    
    17 17
     
    
    18 18
     [Desktop Action StartChat]
    
    19 19
     Exec=gajim --start-chat
    

  • gajim/common/const.py
    ... ... @@ -69,8 +69,10 @@ class KindConstant(IntEnum):
    69 69
         SINGLE_MSG_SENT = 5
    
    70 70
         CHAT_MSG_SENT = 6
    
    71 71
         ERROR = 7
    
    72
    -    FILE_TRANSFER = 8
    
    73
    -    CALL = 9
    
    72
    +    FILE_TRANSFER_INCOMING = 8
    
    73
    +    FILE_TRANSFER_OUTGOING = 9
    
    74
    +    CALL_INCOMING = 10
    
    75
    +    CALL_OUTGOING = 11
    
    74 76
     
    
    75 77
         def __str__(self):
    
    76 78
             return str(self.value)
    

  • gajim/common/jingle_ft.py
    ... ... @@ -151,7 +151,7 @@ def __on_session_initiate(self, stanza, content, error, action):
    151 151
                 account,
    
    152 152
                 jid.bare,
    
    153 153
                 timestamp,
    
    154
    -            KindConstant.FILE_TRANSFER,
    
    154
    +            KindConstant.FILE_TRANSFER_INCOMING,
    
    155 155
                 additional_data=additional_data)
    
    156 156
     
    
    157 157
             if self.session.request:
    

  • gajim/common/jingle_session.py
    ... ... @@ -601,7 +601,7 @@ def __on_session_initiate(self, stanza, jingle, error, action):
    601 601
                 account,
    
    602 602
                 jid.bare,
    
    603 603
                 timestamp,
    
    604
    -            KindConstant.CALL,
    
    604
    +            KindConstant.CALL_INCOMING,
    
    605 605
                 additional_data=additional_data)
    
    606 606
     
    
    607 607
         def __broadcast(self, stanza, jingle, error, action):
    

  • gajim/gtk/call_widget.py
    ... ... @@ -15,6 +15,7 @@
    15 15
     from typing import Optional  # pylint: disable=unused-import
    
    16 16
     
    
    17 17
     import logging
    
    18
    +import time
    
    18 19
     
    
    19 20
     from gi.repository import GObject
    
    20 21
     from gi.repository import Gtk
    
    ... ... @@ -23,6 +24,8 @@
    23 24
     
    
    24 25
     from gajim.common import app
    
    25 26
     from gajim.common.const import JingleState
    
    27
    +from gajim.common.const import KindConstant
    
    28
    +from gajim.common.helpers import AdditionalDataDict
    
    26 29
     from gajim.common.i18n import _
    
    27 30
     from gajim.common.nec import NetworkEvent
    
    28 31
     
    
    ... ... @@ -138,6 +141,7 @@ def _on_jingle_button_toggled(self, jingle_types):
    138 141
                     self._contact.jid)
    
    139 142
                 self._set_jingle_state('audio', JingleState.CONNECTING, sid)
    
    140 143
                 self._set_jingle_state('video', JingleState.CONNECTING, sid)
    
    144
    +            self._store_outgoing_call(sid)
    
    141 145
                 return
    
    142 146
     
    
    143 147
             if 'audio' in jingle_types:
    
    ... ... @@ -147,6 +151,7 @@ def _on_jingle_button_toggled(self, jingle_types):
    147 151
                     sid = self._client.get_module('Jingle').start_audio(
    
    148 152
                         self._contact.jid)
    
    149 153
                     self._set_jingle_state('audio', JingleState.CONNECTING, sid)
    
    154
    +                self._store_outgoing_call(sid)
    
    150 155
     
    
    151 156
             if 'video' in jingle_types:
    
    152 157
                 if self._jingle['video'].state != JingleState.NULL:
    
    ... ... @@ -155,6 +160,17 @@ def _on_jingle_button_toggled(self, jingle_types):
    155 160
                     sid = self._client.get_module('Jingle').start_video(
    
    156 161
                         self._contact.jid)
    
    157 162
                     self._set_jingle_state('video', JingleState.CONNECTING, sid)
    
    163
    +                self._store_outgoing_call(sid)
    
    164
    +
    
    165
    +    def _store_outgoing_call(self, sid):
    
    166
    +        additional_data = AdditionalDataDict()
    
    167
    +        additional_data.set_value('gajim', 'sid', sid)
    
    168
    +        app.storage.archive.insert_into_logs(
    
    169
    +            self._account,
    
    170
    +            self._contact.jid.bare,
    
    171
    +            time.time(),
    
    172
    +            KindConstant.CALL_OUTGOING,
    
    173
    +            additional_data=additional_data)
    
    158 174
     
    
    159 175
         def _on_num_button_pressed(self, _widget, num):
    
    160 176
             self._get_audio_content().start_dtmf(num)
    

  • gajim/gtk/chat_list.py
    ... ... @@ -464,13 +464,15 @@ def __init__(self, workspace_id, account, jid, type_, pinned):
    464 464
                 uf_timestamp = get_uf_relative_time(line.time)
    
    465 465
                 self._ui.timestamp_label.set_text(uf_timestamp)
    
    466 466
     
    
    467
    -        if line.kind == KindConstant.FILE_TRANSFER:
    
    467
    +        if line.kind in (KindConstant.FILE_TRANSFER_INCOMING,
    
    468
    +                         KindConstant.FILE_TRANSFER_OUTGOING):
    
    468 469
                 self._ui.message_label.set_text(_('File Transfer'))
    
    469 470
                 self.timestamp = line.time
    
    470 471
                 uf_timestamp = get_uf_relative_time(line.time)
    
    471 472
                 self._ui.timestamp_label.set_text(uf_timestamp)
    
    472 473
     
    
    473
    -        if line.kind == KindConstant.CALL:
    
    474
    +        if line.kind in (KindConstant.CALL_INCOMING,
    
    475
    +                         KindConstant.CALL_OUTGOING):
    
    474 476
                 self._ui.message_label.set_text(_('Call'))
    
    475 477
                 self.timestamp = line.time
    
    476 478
                 uf_timestamp = get_uf_relative_time(line.time)
    

  • gajim/gtk/controls/base.py
    ... ... @@ -1360,13 +1360,15 @@ def fetch_n_lines_history(self, _scrolled, before, n_lines):
    1360 1360
     
    
    1361 1361
         def add_messages(self, messages):
    
    1362 1362
             for msg in messages:
    
    1363
    -            if msg.kind == KindConstant.FILE_TRANSFER:
    
    1363
    +            if msg.kind in (KindConstant.FILE_TRANSFER_INCOMING,
    
    1364
    +                            KindConstant.FILE_TRANSFER_OUTGOING):
    
    1364 1365
                     if msg.additional_data.get_value('gajim', 'type') == 'jingle':
    
    1365 1366
                         self.conversation_view.add_jingle_file_transfer(
    
    1366 1367
                             db_message=msg)
    
    1367 1368
                     continue
    
    1368 1369
     
    
    1369
    -            if msg.kind == KindConstant.CALL:
    
    1370
    +            if msg.kind in (KindConstant.CALL_INCOMING,
    
    1371
    +                            KindConstant.CALL_OUTGOING):
    
    1370 1372
                     self.conversation_view.add_call_message(db_message=msg)
    
    1371 1373
                     continue
    
    1372 1374
     
    

  • gajim/gtk/filetransfer.py
    ... ... @@ -414,7 +414,7 @@ def send_file(self, account, contact, resource_jid, file_path,
    414 414
                 account,
    
    415 415
                 contact.jid.bare,
    
    416 416
                 time.time(),
    
    417
    -            KindConstant.FILE_TRANSFER,
    
    417
    +            KindConstant.FILE_TRANSFER_OUTGOING,
    
    418 418
                 additional_data=additional_data)
    
    419 419
     
    
    420 420
             client = app.get_client(account)