Update to XEP-0234 version 0.18.0 (:5 namespace).

This commit is contained in:
Emmanuel Gil Peyrot 2017-06-14 20:31:29 +01:00
parent 8356256f17
commit 09e6cfbbc8
8 changed files with 14 additions and 14 deletions

View File

@ -51,7 +51,7 @@ from common.logger import KindConstant
from nbxmpp.protocol import NS_XHTML, NS_XHTML_IM, NS_FILE, NS_MUC from nbxmpp.protocol import NS_XHTML, NS_XHTML_IM, NS_FILE, NS_MUC
from nbxmpp.protocol import NS_ESESSION from nbxmpp.protocol import NS_ESESSION
from nbxmpp.protocol import NS_JINGLE_RTP_AUDIO, NS_JINGLE_RTP_VIDEO from nbxmpp.protocol import NS_JINGLE_RTP_AUDIO, NS_JINGLE_RTP_VIDEO
from nbxmpp.protocol import NS_JINGLE_ICE_UDP, NS_JINGLE_FILE_TRANSFER from nbxmpp.protocol import NS_JINGLE_ICE_UDP, NS_JINGLE_FILE_TRANSFER_5
from nbxmpp.protocol import NS_CHATSTATES from nbxmpp.protocol import NS_CHATSTATES
from common.connection_handlers_events import MessageOutgoingEvent from common.connection_handlers_events import MessageOutgoingEvent
from common.exceptions import GajimGeneralException from common.exceptions import GajimGeneralException
@ -387,7 +387,7 @@ class ChatControl(ChatControlBase):
# Send file # Send file
if ((self.contact.supports(NS_FILE) or \ if ((self.contact.supports(NS_FILE) or \
self.contact.supports(NS_JINGLE_FILE_TRANSFER)) and \ self.contact.supports(NS_JINGLE_FILE_TRANSFER_5)) and \
(self.type_id == 'chat' or self.gc_contact.resource)) and \ (self.type_id == 'chat' or self.gc_contact.resource)) and \
self.contact.show != 'offline': self.contact.show != 'offline':
self._send_file_button.set_sensitive(True) self._send_file_button.set_sensitive(True)
@ -395,7 +395,7 @@ class ChatControl(ChatControlBase):
else: else:
self._send_file_button.set_sensitive(False) self._send_file_button.set_sensitive(False)
if not (self.contact.supports(NS_FILE) or self.contact.supports( if not (self.contact.supports(NS_FILE) or self.contact.supports(
NS_JINGLE_FILE_TRANSFER)): NS_JINGLE_FILE_TRANSFER_5)):
self._send_file_button.set_tooltip_text(_( self._send_file_button.set_tooltip_text(_(
"This contact does not support file transfer.")) "This contact does not support file transfer."))
else: else:

View File

@ -39,11 +39,11 @@ log = logging.getLogger('gajim.c.caps_cache')
from nbxmpp import (NS_XHTML_IM, NS_ESESSION, NS_CHATSTATES, from nbxmpp import (NS_XHTML_IM, NS_ESESSION, NS_CHATSTATES,
NS_JINGLE_ICE_UDP, NS_JINGLE_RTP_AUDIO, NS_JINGLE_RTP_VIDEO, NS_JINGLE_ICE_UDP, NS_JINGLE_RTP_AUDIO, NS_JINGLE_RTP_VIDEO,
NS_JINGLE_FILE_TRANSFER) NS_JINGLE_FILE_TRANSFER_5)
# Features where we cannot safely assume that the other side supports them # Features where we cannot safely assume that the other side supports them
FEATURE_BLACKLIST = [NS_CHATSTATES, NS_XHTML_IM, NS_ESESSION, FEATURE_BLACKLIST = [NS_CHATSTATES, NS_XHTML_IM, NS_ESESSION,
NS_JINGLE_ICE_UDP, NS_JINGLE_RTP_AUDIO, NS_JINGLE_RTP_VIDEO, NS_JINGLE_ICE_UDP, NS_JINGLE_RTP_AUDIO, NS_JINGLE_RTP_VIDEO,
NS_JINGLE_FILE_TRANSFER] NS_JINGLE_FILE_TRANSFER_5]
# Query entry status codes # Query entry status codes
NEW = 0 NEW = 0

View File

@ -187,7 +187,7 @@ class ConnectionDisco:
query.setAttr('node', 'http://gajim.org#' + gajim.version.split('-', 1)[ query.setAttr('node', 'http://gajim.org#' + gajim.version.split('-', 1)[
0]) 0])
for f in (nbxmpp.NS_BYTESTREAM, nbxmpp.NS_SI, nbxmpp.NS_FILE, for f in (nbxmpp.NS_BYTESTREAM, nbxmpp.NS_SI, nbxmpp.NS_FILE,
nbxmpp.NS_COMMANDS, nbxmpp.NS_JINGLE_FILE_TRANSFER, nbxmpp.NS_COMMANDS, nbxmpp.NS_JINGLE_FILE_TRANSFER_5,
nbxmpp.NS_JINGLE_XTLS, nbxmpp.NS_PUBKEY_PUBKEY, nbxmpp.NS_PUBKEY_REVOKE, nbxmpp.NS_JINGLE_XTLS, nbxmpp.NS_PUBKEY_PUBKEY, nbxmpp.NS_PUBKEY_REVOKE,
nbxmpp.NS_PUBKEY_ATTEST): nbxmpp.NS_PUBKEY_ATTEST):
feature = nbxmpp.Node('feature') feature = nbxmpp.Node('feature')

View File

@ -1289,7 +1289,7 @@ def update_optional_features(account = None):
gajim.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_RTP_VIDEO) gajim.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_RTP_VIDEO)
gajim.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_ICE_UDP) gajim.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_ICE_UDP)
gajim.gajim_optional_features[a].append( gajim.gajim_optional_features[a].append(
nbxmpp.NS_JINGLE_FILE_TRANSFER) nbxmpp.NS_JINGLE_FILE_TRANSFER_5)
gajim.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_XTLS) gajim.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_XTLS)
gajim.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_BYTESTREAM) gajim.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_BYTESTREAM)
gajim.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_IBB) gajim.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_IBB)

View File

@ -175,7 +175,7 @@ class JingleContent:
def _fill_content(self, content): def _fill_content(self, content):
description_node = nbxmpp.simplexml.Node( description_node = nbxmpp.simplexml.Node(
tag=nbxmpp.NS_JINGLE_FILE_TRANSFER + ' description') tag=nbxmpp.NS_JINGLE_FILE_TRANSFER_5 + ' description')
file_tag = description_node.setTag('file') file_tag = description_node.setTag('file')
if self.file_props.name: if self.file_props.name:
node = nbxmpp.simplexml.Node(tag='name') node = nbxmpp.simplexml.Node(tag='name')

View File

@ -155,7 +155,7 @@ class JingleFileTransfer(JingleContent):
checksum = nbxmpp.Node(tag='checksum', checksum = nbxmpp.Node(tag='checksum',
payload=[nbxmpp.Node(tag='file', payload=[nbxmpp.Node(tag='file',
payload=[self._compute_hash()])]) payload=[self._compute_hash()])])
checksum.setNamespace(nbxmpp.NS_JINGLE_FILE_TRANSFER) checksum.setNamespace(nbxmpp.NS_JINGLE_FILE_TRANSFER_5)
self.session.__session_info(checksum) self.session.__session_info(checksum)
pjid = gajim.get_jid_without_resource(self.session.peerjid) pjid = gajim.get_jid_without_resource(self.session.peerjid)
file_info = {'name' : self.file_props.name, file_info = {'name' : self.file_props.name,
@ -410,4 +410,4 @@ class JingleFileTransfer(JingleContent):
def get_content(desc): def get_content(desc):
return JingleFileTransfer return JingleFileTransfer
contents[nbxmpp.NS_JINGLE_FILE_TRANSFER] = get_content contents[nbxmpp.NS_JINGLE_FILE_TRANSFER_5] = get_content

View File

@ -40,7 +40,7 @@ from common import helpers
from common.file_props import FilesProp from common.file_props import FilesProp
from common.protocol.bytestream import (is_transfer_active, is_transfer_paused, from common.protocol.bytestream import (is_transfer_active, is_transfer_paused,
is_transfer_stopped) is_transfer_stopped)
from nbxmpp.protocol import NS_JINGLE_FILE_TRANSFER from nbxmpp.protocol import NS_JINGLE_FILE_TRANSFER_5
import logging import logging
log = logging.getLogger('gajim.filetransfer_window') log = logging.getLogger('gajim.filetransfer_window')
@ -357,7 +357,7 @@ class FileTransfersWindow:
file_path, file_name, file_desc) file_path, file_name, file_desc)
if file_props is None: if file_props is None:
return False return False
if contact.supports(NS_JINGLE_FILE_TRANSFER): if contact.supports(NS_JINGLE_FILE_TRANSFER_5):
log.info("contact %s supports jingle file transfer"%(contact.get_full_jid())) log.info("contact %s supports jingle file transfer"%(contact.get_full_jid()))
gajim.connections[account].start_file_transfer(contact.get_full_jid(), gajim.connections[account].start_file_transfer(contact.get_full_jid(),
file_props) file_props)

View File

@ -27,7 +27,7 @@ from common import gajim
from common import helpers from common import helpers
from common import i18n from common import i18n
from nbxmpp.protocol import NS_COMMANDS, NS_FILE, NS_MUC, NS_ESESSION from nbxmpp.protocol import NS_COMMANDS, NS_FILE, NS_MUC, NS_ESESSION
from nbxmpp.protocol import NS_JINGLE_FILE_TRANSFER, NS_CONFERENCE from nbxmpp.protocol import NS_JINGLE_FILE_TRANSFER_5, NS_CONFERENCE
from gtkgui_helpers import get_action from gtkgui_helpers import get_action
def build_resources_submenu(contacts, account, action, room_jid=None, def build_resources_submenu(contacts, account, action, room_jid=None,
@ -260,7 +260,7 @@ control=None, gc_contact=None, is_anonymous=True):
else: else:
start_chat_menuitem.connect('activate', start_chat_menuitem.connect('activate',
gajim.interface.on_open_chat_window, contact, account) gajim.interface.on_open_chat_window, contact, account)
if contact.supports(NS_FILE) or contact.supports(NS_JINGLE_FILE_TRANSFER): if contact.supports(NS_FILE) or contact.supports(NS_JINGLE_FILE_TRANSFER_5):
send_file_menuitem.set_sensitive(True) send_file_menuitem.set_sensitive(True)
send_file_menuitem.connect('activate', send_file_menuitem.connect('activate',
roster.on_send_file_menuitem_activate, contact, account) roster.on_send_file_menuitem_activate, contact, account)