Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pg mr
gajim
Commits
61605616
Commit
61605616
authored
Aug 27, 2020
by
Philipp Hörist
Browse files
Use new JID attributes/methods
parent
0aba0f32
Changes
46
Hide whitespace changes
Inline
Side-by-side
gajim/application.py
View file @
61605616
...
...
@@ -248,12 +248,12 @@ def _open_uris(self, uris):
jid
,
cmd
=
uri
,
'message'
try
:
jid
=
JID
(
jid
)
jid
=
JID
.
from_string
(
jid
)
except
InvalidJid
as
error
:
app
.
log
(
'uri_handler'
).
warning
(
'Invalid JID %s: %s'
,
uri
,
error
)
continue
if
cmd
==
'join'
and
jid
.
getR
esource
()
:
if
cmd
==
'join'
and
jid
.
r
esource
:
app
.
log
(
'uri_handler'
).
warning
(
'Invalid MUC JID %s'
,
uri
)
continue
...
...
gajim/chat_control.py
View file @
61605616
...
...
@@ -578,7 +578,7 @@ def _on_mam_decrypted_message_received(self, event):
if
not
event
.
properties
.
jid
==
self
.
contact
.
get_full_jid
():
return
else
:
if
not
event
.
properties
.
jid
.
bare
M
atch
(
self
.
contact
.
jid
):
if
not
event
.
properties
.
jid
.
bare
_m
atch
(
self
.
contact
.
jid
):
return
kind
=
''
# incoming
...
...
gajim/common/app.py
View file @
61605616
...
...
@@ -572,9 +572,8 @@ def get_recent_groupchats(account):
recent_list
=
[]
for
groupchat
in
recent_groupchats
:
jid
=
nbxmpp
.
JID
(
groupchat
)
recent
=
RecentGroupchat
(
jid
.
getNode
(),
jid
.
getDomain
(),
jid
.
getResource
())
jid
=
nbxmpp
.
JID
.
from_string
(
groupchat
)
recent
=
RecentGroupchat
(
jid
.
localpart
,
jid
.
domain
,
jid
.
resource
)
recent_list
.
append
(
recent
)
return
recent_list
...
...
gajim/common/client.py
View file @
61605616
...
...
@@ -347,7 +347,7 @@ def get_own_jid(self):
return
jid
# This returns the bare jid
return
nbxmpp
.
JID
(
app
.
get_jid_from_account
(
self
.
_account
))
return
nbxmpp
.
JID
.
from_string
(
app
.
get_jid_from_account
(
self
.
_account
))
def
change_status
(
self
,
show
,
message
):
if
not
message
:
...
...
gajim/common/connection_handlers.py
View file @
61605616
...
...
@@ -159,7 +159,7 @@ def make_new_session(self, jid, thread_id=None, type_='chat', cls=None):
if
not
cls
:
cls
=
app
.
default_session_type
sess
=
cls
(
self
,
nbxmpp
.
JID
(
jid
),
thread_id
,
type_
)
sess
=
cls
(
self
,
nbxmpp
.
JID
.
from_string
(
jid
),
thread_id
,
type_
)
# determine if this session is a pm session
# if not, discard the resource so that all sessions are stored bare
...
...
gajim/common/helpers.py
View file @
61605616
...
...
@@ -1199,17 +1199,17 @@ def get_default_muc_config():
def
validate_jid
(
jid
,
type_
=
None
):
try
:
jid
=
JID
(
str
(
jid
))
jid
=
JID
.
from_string
(
str
(
jid
))
except
InvalidJid
as
error
:
raise
ValueError
(
error
)
if
type_
is
None
:
return
jid
if
type_
==
'bare'
and
jid
.
is
B
are
:
if
type_
==
'bare'
and
jid
.
is
_b
are
:
return
jid
if
type_
==
'full'
and
jid
.
is
F
ull
:
if
type_
==
'full'
and
jid
.
is
_f
ull
:
return
jid
if
type_
==
'domain'
and
jid
.
is
D
omain
:
if
type_
==
'domain'
and
jid
.
is
_d
omain
:
return
jid
raise
ValueError
(
'Not a %s JID'
%
type_
)
...
...
gajim/common/jingle_session.py
View file @
61605616
...
...
@@ -679,7 +679,7 @@ def __reason_from_stanza(stanza):
return
(
reason
,
text
)
def
__make_jingle
(
self
,
action
,
reason
=
None
):
stanza
=
nbxmpp
.
Iq
(
typ
=
'set'
,
to
=
nbxmpp
.
JID
(
self
.
peerjid
),
stanza
=
nbxmpp
.
Iq
(
typ
=
'set'
,
to
=
nbxmpp
.
JID
.
from_string
(
self
.
peerjid
),
frm
=
self
.
ourjid
)
attrs
=
{
'action'
:
action
,
...
...
gajim/common/logger.py
View file @
61605616
...
...
@@ -168,7 +168,7 @@ def _jid_adapter(jid):
return
str
(
jid
)
def
_jid_converter
(
jid
):
return
JID
(
jid
.
decode
())
return
JID
.
from_string
(
jid
.
decode
())
sqlite
.
register_converter
(
'jid'
,
_jid_converter
)
...
...
gajim/common/modules/adhoc_commands.py
View file @
61605616
...
...
@@ -209,13 +209,13 @@ def __init__(self, con):
self
.
_sessions
=
{}
def
get_own_bare_jid
(
self
):
return
self
.
_con
.
get_own_jid
().
getStripped
()
return
self
.
_con
.
get_own_jid
().
bare
def
is_same_jid
(
self
,
jid
):
"""
Test if the bare jid given is the same as our bare jid
"""
return
nbxmpp
.
JID
(
jid
).
getStripped
()
==
self
.
get_own_bare_jid
()
return
nbxmpp
.
JID
.
from_string
(
jid
).
bare
==
self
.
get_own_bare_jid
()
def
command_list_query
(
self
,
stanza
):
iq
=
stanza
.
buildReply
(
'result'
)
...
...
gajim/common/modules/announce.py
View file @
61605616
...
...
@@ -24,7 +24,7 @@ def __init__(self, con):
BaseModule
.
__init__
(
self
,
con
)
def
delete_motd
(
self
):
server
=
self
.
_con
.
get_own_jid
().
getD
omain
()
server
=
self
.
_con
.
get_own_jid
().
d
omain
jid
=
'%s/announce/motd/delete'
%
server
self
.
set_announce
(
jid
)
...
...
gajim/common/modules/caps.py
View file @
61605616
...
...
@@ -113,7 +113,7 @@ def _entity_caps(self, _con, _stanza, properties):
NetworkEvent
(
'caps-update'
,
account
=
self
.
_account
,
fjid
=
jid
,
jid
=
properties
.
jid
.
getB
are
()
))
jid
=
properties
.
jid
.
b
are
))
def
_execute_task
(
self
,
task
):
self
.
_log
.
info
(
'Request %s from %s'
,
task
.
entity
.
hash
,
task
.
entity
.
jid
)
...
...
@@ -160,7 +160,7 @@ def _on_disco_info(self, disco_info):
NetworkEvent
(
'caps-update'
,
account
=
self
.
_account
,
fjid
=
str
(
task
.
entity
.
jid
),
jid
=
task
.
entity
.
jid
.
getB
are
()
))
jid
=
task
.
entity
.
jid
.
b
are
))
def
update_caps
(
self
):
if
not
app
.
account_is_connected
(
self
.
_account
):
...
...
@@ -209,7 +209,7 @@ def preconditions_met(self):
if
self
.
_from_muc
:
muc
=
client
.
get_module
(
'MUC'
).
get_manager
().
get
(
self
.
entity
.
jid
.
getB
are
()
)
self
.
entity
.
jid
.
b
are
)
if
muc
is
None
or
not
muc
.
state
.
is_joined
:
self
.
set_obsolete
()
...
...
gajim/common/modules/chatstates.py
View file @
61605616
...
...
@@ -105,12 +105,12 @@ def _presence_received(self,
return
full_jid
=
stanza
.
getFrom
()
if
full_jid
is
None
or
self
.
_con
.
get_own_jid
().
bare
M
atch
(
full_jid
):
if
full_jid
is
None
or
self
.
_con
.
get_own_jid
().
bare
_m
atch
(
full_jid
):
# Presence from ourself
return
contact
=
app
.
contacts
.
get_gc_contact
(
self
.
_account
,
full_jid
.
getStripped
()
,
full_jid
.
getR
esource
()
)
self
.
_account
,
full_jid
.
bare
,
full_jid
.
r
esource
)
if
contact
is
None
:
contact
=
app
.
contacts
.
get_contact_from_full_jid
(
self
.
_account
,
str
(
full_jid
))
...
...
@@ -150,8 +150,8 @@ def _process_chatstate(self, _con, _stanza, properties):
if
properties
.
is_muc_pm
:
contact
=
app
.
contacts
.
get_gc_contact
(
self
.
_account
,
properties
.
jid
.
getB
are
()
,
properties
.
jid
.
getR
esource
()
)
properties
.
jid
.
b
are
,
properties
.
jid
.
r
esource
)
else
:
contact
=
app
.
contacts
.
get_contact_from_full_jid
(
self
.
_account
,
str
(
properties
.
jid
))
...
...
@@ -224,7 +224,7 @@ def get_active_chatstate(self, contact: ContactT) -> Optional[str]:
if
not
contact
.
is_groupchat
:
# Don’t send chatstates to ourself
if
self
.
_con
.
get_own_jid
().
bare
M
atch
(
contact
.
jid
):
if
self
.
_con
.
get_own_jid
().
bare
_m
atch
(
contact
.
jid
):
return
None
if
not
contact
.
supports
(
Namespace
.
CHATSTATES
):
...
...
@@ -256,7 +256,7 @@ def set_chatstate_delayed(self, contact: ContactT, state: State) -> None:
@
ensure_enabled
def
set_chatstate
(
self
,
contact
:
ContactT
,
state
:
State
)
->
None
:
# Don’t send chatstates to ourself
if
self
.
_con
.
get_own_jid
().
bare
M
atch
(
contact
.
jid
):
if
self
.
_con
.
get_own_jid
().
bare
_m
atch
(
contact
.
jid
):
return
if
contact
.
jid
in
self
.
_blocked
:
...
...
gajim/common/modules/discovery.py
View file @
61605616
...
...
@@ -59,7 +59,7 @@ def server_info(self):
return
self
.
_server_info
def
discover_server_items
(
self
):
server
=
self
.
_con
.
get_own_jid
().
getD
omain
()
server
=
self
.
_con
.
get_own_jid
().
d
omain
self
.
disco_items
(
server
,
callback
=
self
.
_server_items_received
)
def
_server_items_received
(
self
,
result
):
...
...
@@ -95,7 +95,7 @@ def _server_items_info_received(self, result):
NetworkIncomingEvent
(
'server-disco-received'
))
def
discover_account_info
(
self
):
own_jid
=
self
.
_con
.
get_own_jid
().
getStripped
()
own_jid
=
self
.
_con
.
get_own_jid
().
bare
self
.
disco_info
(
own_jid
,
callback
=
self
.
_account_info_received
)
def
_account_info_received
(
self
,
result
):
...
...
@@ -120,7 +120,7 @@ def _account_info_received(self, result):
def
discover_server_info
(
self
):
# Calling this method starts the connect_maschine()
server
=
self
.
_con
.
get_own_jid
().
getD
omain
()
server
=
self
.
_con
.
get_own_jid
().
d
omain
self
.
disco_info
(
server
,
callback
=
self
.
_server_info_received
)
def
_server_info_received
(
self
,
result
):
...
...
gajim/common/modules/gateway.py
View file @
61605616
...
...
@@ -41,7 +41,7 @@ def _on_unsubscribe_result(self, _nbxmpp_client, stanza):
self
.
_log
.
info
(
'Error: %s'
,
stanza
.
getError
())
return
agent
=
stanza
.
getFrom
().
getB
are
()
agent
=
stanza
.
getFrom
().
b
are
jid_list
=
[]
for
jid
in
app
.
contacts
.
get_jid_list
(
self
.
_account
):
if
jid
.
endswith
(
'@'
+
agent
):
...
...
@@ -72,8 +72,8 @@ def request_gateway_prompt(self, jid, prompt=None):
def
_on_prompt_result
(
self
,
_nbxmpp_client
,
stanza
):
jid
=
str
(
stanza
.
getFrom
())
fjid
=
stanza
.
getFrom
().
getB
are
()
resource
=
stanza
.
getFrom
().
getR
esource
()
fjid
=
stanza
.
getFrom
().
b
are
resource
=
stanza
.
getFrom
().
r
esource
query
=
stanza
.
getTag
(
'query'
)
if
query
is
not
None
:
...
...
gajim/common/modules/iq.py
View file @
61605616
...
...
@@ -50,7 +50,7 @@ def _iq_error_received(self, _con, _stanza, properties):
app
.
nec
.
push_incoming_event
(
NetworkEvent
(
'file-request-error'
,
conn
=
self
.
_con
,
jid
=
properties
.
jid
.
getB
are
()
,
jid
=
properties
.
jid
.
b
are
,
file_props
=
file_props
,
error_msg
=
to_user_string
(
properties
.
error
)))
self
.
_con
.
get_module
(
'Bytestream'
).
disconnect_transfer
(
...
...
gajim/common/modules/mam.py
View file @
61605616
...
...
@@ -93,7 +93,7 @@ def _from_valid_archive(self, _stanza, properties):
else
:
expected_archive
=
self
.
_con
.
get_own_jid
()
return
properties
.
mam
.
archive
.
bare
M
atch
(
expected_archive
)
return
properties
.
mam
.
archive
.
bare
_m
atch
(
expected_archive
)
def
_get_unique_id
(
self
,
properties
):
if
properties
.
type
.
is_groupchat
:
...
...
@@ -105,7 +105,7 @@ def _get_unique_id(self, properties):
if
properties
.
is_muc_pm
:
return
properties
.
mam
.
id
,
properties
.
id
if
self
.
_con
.
get_own_jid
().
bare
M
atch
(
properties
.
from_
):
if
self
.
_con
.
get_own_jid
().
bare
_m
atch
(
properties
.
from_
):
# message we sent
return
properties
.
mam
.
id
,
properties
.
id
...
...
@@ -119,7 +119,7 @@ def _set_message_archive_info(self, _con, _stanza, properties):
return
if
properties
.
type
.
is_groupchat
:
archive_jid
=
properties
.
jid
.
getB
are
()
archive_jid
=
properties
.
jid
.
b
are
timestamp
=
properties
.
timestamp
disco_info
=
app
.
logger
.
get_last_disco_info
(
archive_jid
)
...
...
@@ -136,7 +136,7 @@ def _set_message_archive_info(self, _con, _stanza, properties):
if
not
self
.
available
:
return
archive_jid
=
self
.
_con
.
get_own_jid
().
getB
are
()
archive_jid
=
self
.
_con
.
get_own_jid
().
b
are
timestamp
=
None
if
properties
.
stanza_id
is
None
:
...
...
@@ -179,7 +179,7 @@ def _mam_message_received(self, _con, stanza, properties):
if
is_groupchat
:
kind
=
KindConstant
.
GC_MSG
else
:
if
properties
.
from_
.
bare
M
atch
(
self
.
_con
.
get_own_jid
()):
if
properties
.
from_
.
bare
_m
atch
(
self
.
_con
.
get_own_jid
()):
kind
=
KindConstant
.
CHAT_MSG_SENT
else
:
kind
=
KindConstant
.
CHAT_MSG_RECV
...
...
@@ -217,7 +217,7 @@ def _mam_message_received(self, _con, stanza, properties):
self
.
_log
.
debug
(
stanza
.
getProperties
())
return
with_
=
properties
.
jid
.
getStripped
()
with_
=
properties
.
jid
.
bare
if
properties
.
is_muc_pm
:
# we store the message with the full JID
with_
=
str
(
with_
)
...
...
@@ -262,7 +262,7 @@ def _get_query_id(self, jid):
return
query_id
def
request_archive_on_signin
(
self
):
own_jid
=
self
.
_con
.
get_own_jid
().
getB
are
()
own_jid
=
self
.
_con
.
get_own_jid
().
b
are
if
own_jid
in
self
.
_mam_query_ids
:
self
.
_log
.
warning
(
'Request already running: %s'
,
own_jid
)
...
...
@@ -407,7 +407,7 @@ def request_archive_interval(self,
after
=
None
,
queryid
=
None
):
jid
=
self
.
_con
.
get_own_jid
().
getB
are
()
jid
=
self
.
_con
.
get_own_jid
().
b
are
if
after
is
None
:
self
.
_log
.
info
(
'Request interval: %s, from %s to %s'
,
...
...
gajim/common/modules/message.py
View file @
61605616
...
...
@@ -62,7 +62,7 @@ def _check_if_unknown_contact(self, _con, stanza, properties):
properties
.
is_mam_message
):
return
if
self
.
_con
.
get_own_jid
().
getD
omain
()
==
str
(
properties
.
jid
):
if
self
.
_con
.
get_own_jid
().
d
omain
==
str
(
properties
.
jid
):
# Server message
return
...
...
@@ -70,7 +70,7 @@ def _check_if_unknown_contact(self, _con, stanza, properties):
'ignore_unknown_contacts'
):
return
jid
=
properties
.
jid
.
getB
are
()
jid
=
properties
.
jid
.
b
are
if
self
.
_con
.
get_module
(
'Roster'
).
get_item
(
jid
)
is
None
:
self
.
_log
.
warning
(
'Ignore message from unknown contact: %s'
,
jid
)
self
.
_log
.
warning
(
stanza
)
...
...
@@ -103,8 +103,8 @@ def _message_received(self, _con, stanza, properties):
from_
=
stanza
.
getFrom
()
fjid
=
str
(
from_
)
jid
=
from_
.
getB
are
()
resource
=
from_
.
getR
esource
()
jid
=
from_
.
b
are
resource
=
from_
.
r
esource
type_
=
properties
.
type
...
...
@@ -115,14 +115,14 @@ def _message_received(self, _con, stanza, properties):
# Don’t check for message text because the message could be
# encrypted.
if
app
.
logger
.
deduplicate_muc_message
(
self
.
_account
,
properties
.
jid
.
getB
are
()
,
properties
.
jid
.
getR
esource
()
,
properties
.
jid
.
b
are
,
properties
.
jid
.
r
esource
,
properties
.
timestamp
,
properties
.
id
):
raise
nbxmpp
.
NodeProcessed
if
(
properties
.
is_self_message
or
properties
.
is_muc_pm
):
archive_jid
=
self
.
_con
.
get_own_jid
().
getStripped
()
archive_jid
=
self
.
_con
.
get_own_jid
().
bare
if
app
.
logger
.
find_stanza_id
(
self
.
_account
,
archive_jid
,
stanza_id
,
...
...
@@ -214,9 +214,9 @@ def _message_received(self, _con, stanza, properties):
NetworkEvent
(
'decrypted-message-received'
,
**
event_attr
))
def
_message_error_received
(
self
,
_con
,
_stanza
,
properties
):
jid
=
properties
.
jid
.
copy
()
jid
=
properties
.
jid
if
not
properties
.
is_muc_pm
:
jid
.
setB
are
()
jid
=
jid
.
new_as_b
are
()
self
.
_log
.
info
(
properties
.
error
)
...
...
@@ -267,7 +267,7 @@ def _get_unique_id(self, properties):
if
properties
.
type
.
is_groupchat
:
disco_info
=
app
.
logger
.
get_last_disco_info
(
properties
.
jid
.
getB
are
()
)
properties
.
jid
.
b
are
)
if
disco_info
.
mam_namespace
!=
Namespace
.
MAM_2
:
return
None
,
None
...
...
@@ -279,7 +279,7 @@ def _get_unique_id(self, properties):
archive
=
self
.
_con
.
get_own_jid
()
if
archive
.
bare
M
atch
(
properties
.
stanza_id
.
by
):
if
archive
.
bare
_m
atch
(
properties
.
stanza_id
.
by
):
return
properties
.
stanza_id
.
id
,
None
# stanza-id not added by the archive, ignore it.
return
None
,
None
...
...
@@ -329,7 +329,7 @@ def build_message_stanza(self, message):
oob
.
addChild
(
'url'
).
setData
(
message
.
oob_url
)
# XEP-0184
if
not
own_jid
.
bare
M
atch
(
message
.
jid
):
if
not
own_jid
.
bare
_m
atch
(
message
.
jid
):
if
message
.
message
and
not
message
.
is_groupchat
:
stanza
.
setReceiptRequest
()
...
...
gajim/common/modules/muc.py
View file @
61605616
...
...
@@ -162,7 +162,7 @@ def _on_disco_result(self, result):
app
.
nec
.
push_incoming_event
(
NetworkEvent
(
'muc-join-failed'
,
account
=
self
.
_account
,
room_jid
=
result
.
jid
.
getB
are
()
,
room_jid
=
result
.
jid
.
b
are
,
error
=
result
))
return
...
...
@@ -317,7 +317,7 @@ def change_nick(self, room_jid, new_nick):
status
=
message
)
def
_on_error_presence
(
self
,
_con
,
_stanza
,
properties
):
room_jid
=
properties
.
jid
.
getB
are
()
room_jid
=
properties
.
jid
.
b
are
muc_data
=
self
.
_manager
.
get
(
room_jid
)
if
muc_data
is
None
:
return
...
...
@@ -529,7 +529,7 @@ def _raise_muc_event(self, event_name, properties):
app
.
nec
.
push_incoming_event
(
NetworkEvent
(
event_name
,
account
=
self
.
_account
,
room_jid
=
properties
.
jid
.
getB
are
()
,
room_jid
=
properties
.
jid
.
b
are
,
properties
=
properties
))
self
.
_log_muc_event
(
event_name
,
properties
)
...
...
@@ -558,7 +558,7 @@ def _log_muc_event(self, event_name, properties):
app
.
logger
.
insert_into_logs
(
self
.
_account
,
properties
.
jid
.
getB
are
()
,
properties
.
jid
.
b
are
,
properties
.
timestamp
,
KindConstant
.
GCSTATUS
,
contact_name
=
properties
.
muc_nickname
,
...
...
@@ -571,7 +571,7 @@ def _add_new_muc_contact(self, properties):
if
properties
.
muc_user
.
jid
is
not
None
:
real_jid
=
str
(
properties
.
muc_user
.
jid
)
contact
=
app
.
contacts
.
create_gc_contact
(
room_jid
=
properties
.
jid
.
getB
are
()
,
room_jid
=
properties
.
jid
.
b
are
,
account
=
self
.
_account
,
name
=
properties
.
muc_nickname
,
show
=
properties
.
show
,
...
...
@@ -686,7 +686,7 @@ def _on_captcha_challenge(self, _con, _stanza, properties):
app
.
nec
.
push_incoming_event
(
NetworkEvent
(
'muc-captcha-challenge'
,
account
=
self
.
_account
,
room_jid
=
properties
.
jid
.
getB
are
()
,
room_jid
=
properties
.
jid
.
b
are
,
form
=
properties
.
captcha
.
form
))
raise
nbxmpp
.
NodeProcessed
...
...
gajim/common/modules/presence.py
View file @
61605616
...
...
@@ -95,7 +95,7 @@ def _presence_received(self, _con, stanza, properties):
show
=
properties
.
show
.
value
))
return
jid
=
properties
.
jid
.
getB
are
()
jid
=
properties
.
jid
.
b
are
roster_item
=
self
.
_con
.
get_module
(
'Roster'
).
get_item
(
jid
)
if
not
properties
.
is_self_bare
and
roster_item
is
None
:
# Handle only presence from roster contacts
...
...
@@ -114,8 +114,8 @@ def _presence_received(self, _con, stanza, properties):
'need_add_in_roster'
:
False
,
'popup'
:
False
,
'ptype'
:
properties
.
type
.
value
,
'jid'
:
properties
.
jid
.
getB
are
()
,
'resource'
:
properties
.
jid
.
getR
esource
()
,
'jid'
:
properties
.
jid
.
b
are
,
'resource'
:
properties
.
jid
.
r
esource
,
'id_'
:
properties
.
id
,
'fjid'
:
str
(
properties
.
jid
),
'timestamp'
:
properties
.
timestamp
,
...
...
@@ -139,8 +139,8 @@ def _presence_received(self, _con, stanza, properties):
def
_update_contact
(
self
,
event
,
properties
):
# Note: A similar method also exists in connection_zeroconf
jid
=
properties
.
jid
.
getB
are
()
resource
=
properties
.
jid
.
getR
esource
()
jid
=
properties
.
jid
.
b
are
resource
=
properties
.
jid
.
r
esource
status_strings
=
[
'offline'
,
'error'
,
'online'
,
'chat'
,
'away'
,
'xa'
,
'dnd'
]
...
...
@@ -156,8 +156,8 @@ def _update_contact(self, event, properties):
event
.
contact_list
=
contact_list
contact
=
app
.
contacts
.
get_contact_strict
(
self
.
_account
,
properties
.
jid
.
getB
are
()
,
properties
.
jid
.
getR
esource
()
)
properties
.
jid
.
b
are
,
properties
.
jid
.
r
esource
)
if
contact
is
None
:
contact
=
app
.
contacts
.
get_first_contact_from_jid
(
self
.
_account
,
jid
)
...
...
@@ -229,7 +229,7 @@ def _is_resource_known(contact_list):
def
_log_presence
(
self
,
properties
):
if
not
app
.
settings
.
get
(
'log_contact_status_changes'
):
return
if
not
should_log
(
self
.
_account
,
properties
.
jid
.
getB
are
()
):
if
not
should_log
(
self
.
_account
,
properties
.
jid
.
b
are
):
return
show
=
ShowConstant
[
properties
.
show
.
name
]
...
...
@@ -237,14 +237,14 @@ def _log_presence(self, properties):
show
=
ShowConstant
.
OFFLINE
app
.
logger
.
insert_into_logs
(
self
.
_account
,
properties
.
jid
.
getB
are
()
,
properties
.
jid
.
b
are
,
time
.
time
(),
KindConstant
.
STATUS
,
message
=
properties
.
status
,
show
=
show
)
def
_subscribe_received
(
self
,
_con
,
_stanza
,
properties
):
jid
=
properties
.
jid
.
getB
are
()
jid
=
properties
.
jid
.
b
are
fjid
=
str
(
properties
.
jid
)
is_transport
=
app
.
jid_is_transport
(
fjid
)
...
...
@@ -276,7 +276,7 @@ def _subscribe_received(self, _con, _stanza, properties):
raise
nbxmpp
.
NodeProcessed
def
_subscribed_received
(
self
,
_con
,
_stanza
,
properties
):
jid
=
properties
.
jid
.
getB
are
()
jid
=
properties
.
jid
.
b
are
self
.
_log
.
info
(
'Received Subscribed: %s'
,
properties
.
jid
)
if
jid
in
self
.
automatically_added
:
self
.
automatically_added
.
remove
(
jid
)
...
...
@@ -296,7 +296,7 @@ def _unsubscribed_received(self, _con, _stanza, properties):
self
.
_log
.
info
(
'Received Unsubscribed: %s'
,
properties
.
jid
)
app
.
nec
.
push_incoming_event
(
NetworkEvent
(
'unsubscribed-presence-received'
,
conn
=
self
.
_con
,
jid
=
properties
.
jid
.
getB
are
()
))
conn
=
self
.
_con
,
jid
=
properties
.
jid
.
b
are
))
raise
nbxmpp
.
NodeProcessed
def
subscribed
(
self
,
jid
):
...
...
gajim/common/modules/receipts.py
View file @
61605616
...
...
@@ -77,9 +77,9 @@ def _process_message_receipt(self, _con, stanza, properties):
properties
.
jid
,
properties
.
receipt
.
id
)
jid
=
properties
.
jid
.
copy
()
jid
=
properties
.
jid
if
not
properties
.
is_muc_pm
:
jid
.
setB
are
()
jid
=
jid
.
new_as_b
are
()
app
.
logger
.
set_marker
(
app
.
get_jid_from_account
(
self
.
_account
),
jid
,
...
...
@@ -97,11 +97,11 @@ def _process_message_receipt(self, _con, stanza, properties):
def
_get_contact
(
self
,
properties
):
if
properties
.
is_muc_pm
:
return
app
.
contacts
.
get_gc_contact
(
self
.
_account
,
properties
.
jid
.
getB
are
()
,
properties
.
jid
.
getR
esource
()
)
properties
.
jid
.
b
are
,
properties
.
jid
.
r
esource
)
contact
=
app
.
contacts
.
get_contact
(
self
.
_account
,
properties
.
jid
.
getB
are
()
)
properties
.
jid
.
b
are
)
if
contact
is
not
None
and
contact
.
sub
not
in
(
'to'
,
'none'
):
return
contact
return
None
...
...
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment