Philipp Hörist pushed to branch master at gajim / gajim
Commits:
5aff9fb0 by Philipp Hörist at 2019-10-31T05:04:00Z
MAM: Add nbxmpp properties to event
Fixes #9876
- - - - -
1 changed file:
- gajim/common/modules/mam.py
Changes:
=====================================
gajim/common/modules/mam.py
=====================================
@@ -245,6 +245,7 @@ class MAM(BaseModule):
'message': stanza,
'stanza': stanza,
'namespace': properties.mam.namespace,
+ 'properties': properties,
})
app.logger.insert_into_logs(self._account,
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/5aff9fb0bc4325b843ba4d11e90af0770b…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/5aff9fb0bc4325b843ba4d11e90af0770b…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
1f5d81d1 by Sebastiaan Lokhorst at 2019-10-30T23:10:59Z
MacOS: remove debug line from makebundle.py
- - - - -
1 changed file:
- mac/makebundle.py
Changes:
=====================================
mac/makebundle.py
=====================================
@@ -15,7 +15,6 @@ if __name__ == '__main__':
args = parser.parse_args()
if args.version:
- print("args.version:", version)
version = args.version
else:
try:
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/1f5d81d10326ee5dd2dca549ff58091616…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/1f5d81d10326ee5dd2dca549ff58091616…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
31f34991 by Philipp Hörist at 2019-10-29T20:25:23Z
Zeroconf: Fix name conflict
Pass kDNSServiceFlagsNoAutoRename to pybonjour so we dont end up with
invalid names like `user@machine (2)`
Refactor alternativ name suggestion into own method
- - - - -
1 changed file:
- gajim/common/zeroconf/zeroconf_bonjour.py
Changes:
=====================================
gajim/common/zeroconf/zeroconf_bonjour.py
=====================================
@@ -240,17 +240,19 @@ class Zeroconf:
elif errorCode == pybonjour.kDNSServiceErr_NameConflict:
log.error('Error while adding service. %s', errorCode)
- parts = self.username.split(' ')
+ self.name_conflictCB(self._get_alternativ_name(self.username))
+ else:
+ self.error_CB(_('Error while adding service. %s') % str(errorCode))
- # check if last part is a number and if, increment it
+ @staticmethod
+ def _get_alternativ_name(name):
+ if name[-2] == '-':
try:
- stripped = str(int(parts[-1]))
+ number = int(name[-1])
except Exception:
- stripped = 1
- alternative_name = self.username + str(stripped + 1)
- self.name_conflictCB(alternative_name)
- else:
- self.error_CB(_('Error while adding service. %s') % str(errorCode))
+ return '%s-1' % name
+ return '%s-%s' % (name[:-2], number + 1)
+ return '%s-1' % name
# make zeroconf-valid names
def replace_show(self, show):
@@ -280,6 +282,7 @@ class Zeroconf:
self.txt = txt
try:
self.service_sdRef = pybonjour.DNSServiceRegister(
+ flags=pybonjour.kDNSServiceFlagsNoAutoRename,
name=self.name,
regtype=self.stype,
port=self.port,
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/31f3499118fb09c39fda6150bcf0d27c4e…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/31f3499118fb09c39fda6150bcf0d27c4e…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
be2f3053 by Philipp Hörist at 2019-10-26T12:25:08Z
Refactor blocking non-roster messages
- - - - -
2 changed files:
- gajim/common/modules/message.py
- gajim/session.py
Changes:
=====================================
gajim/common/modules/message.py
=====================================
@@ -36,6 +36,9 @@ class Message(BaseModule):
BaseModule.__init__(self, con)
self.handlers = [
+ StanzaHandler(name='message',
+ callback=self._check_if_unknown_contact,
+ priority=41),
StanzaHandler(name='message',
callback=self._message_received,
priority=50),
@@ -49,6 +52,28 @@ class Message(BaseModule):
self._message_namespaces = set([nbxmpp.NS_ROSTERX,
nbxmpp.NS_IBB])
+ def _check_if_unknown_contact(self, _con, stanza, properties):
+ if (properties.type.is_groupchat or
+ properties.is_muc_pm or
+ properties.is_self_message or
+ properties.is_mam_message):
+ return
+
+ if self._con.get_own_jid().getDomain() == str(properties.jid):
+ # Server message
+ return
+
+ if not app.config.get_per('accounts',
+ self._account,
+ 'ignore_unknown_contacts'):
+ return
+
+ jid = properties.jid.getBare()
+ 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)
+ raise nbxmpp.NodeProcessed
+
def _message_received(self, _con, stanza, properties):
if (properties.is_mam_message or
properties.is_pubsub or
=====================================
gajim/session.py
=====================================
@@ -147,11 +147,6 @@ class ChatControlSession:
if not obj.msgtxt: # empty message text
return True
- if app.config.get_per('accounts', self.conn.name,
- 'ignore_unknown_contacts') and not app.contacts.get_contacts(
- self.conn.name, obj.jid) and not pm:
- return True
-
if not self.control:
ctrl = app.interface.msg_win_mgr.search_control(obj.jid,
obj.conn.name, obj.resource)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/be2f305373fef9da9439a1109d07ea7725…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/be2f305373fef9da9439a1109d07ea7725…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
d7af6eb2 by Philipp Hörist at 2019-10-26T06:50:50Z
Chatstates: Never stop message processing inside that module
Clients adding chatstates should not disrupt Gajim
- - - - -
1 changed file:
- gajim/common/modules/chatstates.py
Changes:
=====================================
gajim/common/modules/chatstates.py
=====================================
@@ -137,16 +137,14 @@ class Chatstate(BaseModule):
account=self._account,
contact=contact))
- def _process_chatstate(self, _con, stanza, properties):
+ def _process_chatstate(self, _con, _stanza, properties):
if not properties.has_chatstate:
return
if (properties.is_self_message or
properties.type.is_groupchat or
+ properties.is_mam_message or
properties.is_carbon_message and properties.carbon.is_sent):
- if properties.chatstate in ('inactive', 'gone',
- 'composing', 'paused'):
- raise nbxmpp.NodeProcessed
return
if properties.is_muc_pm:
@@ -167,15 +165,6 @@ class Chatstate(BaseModule):
account=self._account,
contact=contact))
- if properties.chatstate in ('inactive', 'gone', 'composing', 'paused'):
- if properties.body is None:
- # So we dont lose a message if a client implements not
- # recomended behavior
- raise nbxmpp.NodeProcessed
-
- self._log.warning('Chatstate with body received')
- self._log.warning(stanza)
-
@ensure_enabled
def _check_last_interaction(self) -> GLib.SOURCE_CONTINUE:
now = time.time()
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/d7af6eb2f229ebf9718bdccb0737515feb…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/d7af6eb2f229ebf9718bdccb0737515feb…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
a298bf1c by Philipp Hörist at 2019-10-23T20:09:50Z
Receipts: Don't request receipt in groupchat
- - - - -
bfc49cbf by Philipp Hörist at 2019-10-24T20:56:15Z
Don't stop processing messages after receiving non-active chatstate
Some client implement not recommended behavior and send other chatstates
than active including a <body>
- - - - -
2 changed files:
- gajim/common/connection.py
- gajim/common/modules/chatstates.py
Changes:
=====================================
gajim/common/connection.py
=====================================
@@ -296,7 +296,7 @@ class CommonConnection:
# XEP-0184
if obj.jid != app.get_jid_from_account(self.name):
- if obj.message:
+ if obj.message and obj.type_ != 'groupchat':
msg_iq.setReceiptRequest()
if obj.session:
=====================================
gajim/common/modules/chatstates.py
=====================================
@@ -137,7 +137,7 @@ class Chatstate(BaseModule):
account=self._account,
contact=contact))
- def _process_chatstate(self, _con, _stanza, properties):
+ def _process_chatstate(self, _con, stanza, properties):
if not properties.has_chatstate:
return
@@ -168,7 +168,13 @@ class Chatstate(BaseModule):
contact=contact))
if properties.chatstate in ('inactive', 'gone', 'composing', 'paused'):
- raise nbxmpp.NodeProcessed
+ if properties.body is None:
+ # So we dont lose a message if a client implements not
+ # recomended behavior
+ raise nbxmpp.NodeProcessed
+
+ self._log.warning('Chatstate with body received')
+ self._log.warning(stanza)
@ensure_enabled
def _check_last_interaction(self) -> GLib.SOURCE_CONTINUE:
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/234480956029929a44ffd28e6832d95db…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/234480956029929a44ffd28e6832d95db…
You're receiving this email because of your account on dev.gajim.org.