| ... |
... |
@@ -25,7 +25,7 @@ |
|
25
|
25
|
from gi.repository import Gtk
|
|
26
|
26
|
from gi.repository import GLib
|
|
27
|
27
|
from nbxmpp.const import Affiliation
|
|
28
|
|
-from nbxmpp.structs import MessageProperties
|
|
|
28
|
+from nbxmpp.structs import PresenceProperties
|
|
29
|
29
|
|
|
30
|
30
|
from gajim.common import app
|
|
31
|
31
|
from gajim.common import ged
|
| ... |
... |
@@ -184,6 +184,7 @@ def _query_tooltip(self, |
|
184
|
184
|
|
|
185
|
185
|
nickname = self._store[iter_][Column.NICK_OR_GROUP]
|
|
186
|
186
|
|
|
|
187
|
+ assert self._contact is not None
|
|
187
|
188
|
contact = self._contact.get_resource(nickname)
|
|
188
|
189
|
|
|
189
|
190
|
value, widget = self._tooltip.get_tooltip(contact)
|
| ... |
... |
@@ -283,11 +284,13 @@ def _on_user_nickname_changed(self, |
|
283
|
284
|
contact: types.GroupchatContact,
|
|
284
|
285
|
_signal_name: str,
|
|
285
|
286
|
user_contact: types.GroupchatParticipant,
|
|
286
|
|
- properties: MessageProperties
|
|
|
287
|
+ properties: PresenceProperties
|
|
287
|
288
|
) -> None:
|
|
288
|
289
|
|
|
289
|
290
|
self._remove_contact(user_contact)
|
|
290
|
291
|
|
|
|
292
|
+ assert properties.muc_user is not None
|
|
|
293
|
+ assert properties.muc_user.nick is not None
|
|
291
|
294
|
user_contact = contact.get_resource(properties.muc_user.nick)
|
|
292
|
295
|
self._add_contact(user_contact)
|
|
293
|
296
|
|
| ... |
... |
@@ -361,15 +364,20 @@ def _on_roster_row_activated(self, |
|
361
|
364
|
if self._store.iter_parent(iter_) is None:
|
|
362
|
365
|
# This is a group row
|
|
363
|
366
|
return
|
|
|
367
|
+
|
|
|
368
|
+ assert self._contact is not None
|
|
|
369
|
+
|
|
364
|
370
|
nick = self._store[iter_][Column.NICK_OR_GROUP]
|
|
365
|
371
|
if self._contact.nickname == nick:
|
|
366
|
372
|
return
|
|
367
|
373
|
|
|
368
|
374
|
disco = self._contact.get_disco()
|
|
369
|
375
|
assert disco is not None
|
|
|
376
|
+
|
|
370
|
377
|
muc_prefer_direct_msg = app.settings.get('muc_prefer_direct_msg')
|
|
371
|
378
|
if disco.muc_is_nonanonymous and muc_prefer_direct_msg:
|
|
372
|
379
|
participant = self._contact.get_resource(nick)
|
|
|
380
|
+ assert participant.real_jid is not None
|
|
373
|
381
|
app.window.add_chat(self._contact.account,
|
|
374
|
382
|
participant.real_jid,
|
|
375
|
383
|
'contact',
|
| ... |
... |
@@ -402,6 +410,8 @@ def _on_roster_button_press_event(self, |
|
402
|
410
|
# Group row
|
|
403
|
411
|
return
|
|
404
|
412
|
|
|
|
413
|
+ assert self._contact is not None
|
|
|
414
|
+
|
|
405
|
415
|
nick = self._store[iter_][Column.NICK_OR_GROUP]
|
|
406
|
416
|
if self._contact.nickname == nick:
|
|
407
|
417
|
return
|
| ... |
... |
@@ -416,10 +426,11 @@ def _on_roster_button_press_event(self, |
|
416
|
426
|
# self.roster.emit('row-activated', nick)
|
|
417
|
427
|
|
|
418
|
428
|
def _show_contact_menu(self, nick: str, rect: Gdk.Rectangle) -> None:
|
|
|
429
|
+ assert self._contact is not None
|
|
419
|
430
|
self_contact = self._contact.get_self()
|
|
420
|
431
|
assert self_contact is not None
|
|
421
|
432
|
contact = self._contact.get_resource(nick)
|
|
422
|
|
- menu = get_groupchat_roster_menu(self._account,
|
|
|
433
|
+ menu = get_groupchat_roster_menu(self._contact.account,
|
|
423
|
434
|
self_contact,
|
|
424
|
435
|
contact)
|
|
425
|
436
|
|
| ... |
... |
@@ -461,6 +472,7 @@ def _tree_compare_iters(self, |
|
461
|
472
|
if not app.settings.get('sort_by_show_in_muc'):
|
|
462
|
473
|
return locale.strcoll(nick1.lower(), nick2.lower())
|
|
463
|
474
|
|
|
|
475
|
+ assert self._contact is not None
|
|
464
|
476
|
contact1 = self._contact.get_resource(nick1)
|
|
465
|
477
|
contact2 = self._contact.get_resource(nick2)
|
|
466
|
478
|
|
| ... |
... |
@@ -485,6 +497,7 @@ def enable_sort(self, enable: bool) -> None: |
|
485
|
497
|
|
|
486
|
498
|
def _load_roster(self) -> None:
|
|
487
|
499
|
log.info('Load Roster')
|
|
|
500
|
+ assert self._contact is not None
|
|
488
|
501
|
self._contact.multi_connect({
|
|
489
|
502
|
'user-affiliation-changed': self._update_contact,
|
|
490
|
503
|
'user-avatar-update': self._on_user_avatar_update,
|
| ... |
... |
@@ -504,6 +517,7 @@ def _load_roster(self) -> None: |
|
504
|
517
|
|
|
505
|
518
|
def _unload_roster(self) -> None:
|
|
506
|
519
|
log.info('Unload Roster')
|
|
|
520
|
+ assert self._contact is not None
|
|
507
|
521
|
self._contact.multi_disconnect(self, CONTACT_SIGNALS)
|
|
508
|
522
|
|
|
509
|
523
|
self._roster.set_model(None)
|
| ... |
... |
@@ -527,6 +541,7 @@ def _draw_contact(self, nick: str) -> None: |
|
527
|
541
|
if not iter_:
|
|
528
|
542
|
return
|
|
529
|
543
|
|
|
|
544
|
+ assert self._contact is not None
|
|
530
|
545
|
contact = self._contact.get_resource(nick)
|
|
531
|
546
|
|
|
532
|
547
|
self._draw_avatar(contact)
|