add namespace for jingle file transfer

add jingle FT to gajim.gajim_optional_features
This commit is contained in:
Zhenchao Li 2010-06-01 15:09:42 +08:00
parent 1880d3ec41
commit 01c1465dfb
6 changed files with 16 additions and 6 deletions

View File

@ -51,7 +51,7 @@ from common.logger import constants
from common.pep import MOODS, ACTIVITIES
from common.xmpp.protocol import NS_XHTML, NS_XHTML_IM, NS_FILE, NS_MUC
from common.xmpp.protocol import NS_RECEIPTS, NS_ESESSION
from common.xmpp.protocol import NS_JINGLE_RTP_AUDIO, NS_JINGLE_RTP_VIDEO, NS_JINGLE_ICE_UDP
from common.xmpp.protocol import NS_JINGLE_RTP_AUDIO, NS_JINGLE_RTP_VIDEO, NS_JINGLE_ICE_UDP, NS_JINGLE_FILE_TRANSFER
from command_system.implementation.middleware import ChatCommandProcessor
from command_system.implementation.middleware import CommandTools
@ -1496,12 +1496,12 @@ class ChatControl(ChatControlBase):
self._video_button.set_sensitive(self.video_available)
# Send file
if self.contact.supports(NS_FILE) and self.contact.resource:
if (self.contact.supports(NS_FILE) or self.contact.supports(NS_JINGLE_FILE_TRANSFER)) and self.contact.resource:
self._send_file_button.set_sensitive(True)
self._send_file_button.set_tooltip_text('')
else:
self._send_file_button.set_sensitive(False)
if not self.contact.supports(NS_FILE):
if not (self.contact.supports(NS_FILE) or self.contact.supports(NS_JINGLE_FILE_TRANSFER)):
self._send_file_button.set_tooltip_text(_(
"This contact does not support file transfer."))
else:

View File

@ -182,7 +182,7 @@ class ConnectionDisco:
query = iq.setTag('query')
query.setAttr('node', 'http://gajim.org#' + gajim.version.split('-', 1)[0])
for f in (common.xmpp.NS_BYTESTREAM, common.xmpp.NS_SI,
common.xmpp.NS_FILE, common.xmpp.NS_COMMANDS):
common.xmpp.NS_FILE, common.xmpp.NS_COMMANDS, common.xmpp.NS_JINGLE_FILE_TRANSFER):
feature = common.xmpp.Node('feature')
feature.setAttr('var', f)
query.addChild(node=feature)

View File

@ -1316,6 +1316,7 @@ def update_optional_features(account = None):
gajim.gajim_optional_features[a].append(xmpp.NS_JINGLE_RTP_AUDIO)
gajim.gajim_optional_features[a].append(xmpp.NS_JINGLE_RTP_VIDEO)
gajim.gajim_optional_features[a].append(xmpp.NS_JINGLE_ICE_UDP)
gajim.gajim_optional_features[a].append(xmpp.NS_JINGLE_FILE_TRANSFER)
gajim.caps_hash[a] = caps_cache.compute_caps_hash([gajim.gajim_identity],
gajim.gajim_common_features + gajim.gajim_optional_features[a])
# re-send presence with new hash

View File

@ -69,6 +69,7 @@ NS_JINGLE_ERRORS='urn:xmpp:jingle:errors:1' # XEP-01
NS_JINGLE_RTP ='urn:xmpp:jingle:apps:rtp:1' # XEP-0167
NS_JINGLE_RTP_AUDIO='urn:xmpp:jingle:apps:rtp:audio' # XEP-0167
NS_JINGLE_RTP_VIDEO='urn:xmpp:jingle:apps:rtp:video' # XEP-0167
NS_JINGLE_FILE_TRANSFER='urn:xmpp:jingle:apps:file-transfer:1' # XEP-0234
NS_JINGLE_RAW_UDP='urn:xmpp:jingle:transports:raw-udp:1' # XEP-0177
NS_JINGLE_ICE_UDP='urn:xmpp:jingle:transports:ice-udp:1' # XEP-0176
NS_LAST ='jabber:iq:last'

View File

@ -35,6 +35,10 @@ from common import gajim
from common import helpers
from common.protocol.bytestream import (is_transfer_active, is_transfer_paused,
is_transfer_stopped)
from common.xmpp.protocol import NS_JINGLE_FILE_TRANSFER
import logging
log = logging.getLogger('gajim.filetransfer_window')
C_IMAGE = 0
C_LABELS = 1
@ -299,6 +303,10 @@ class FileTransfersWindow:
if file_props is None:
return False
self.add_transfer(account, contact, file_props)
if contact.supports(NS_JINGLE_FILE_TRANSFER):
log.info("contacts supports jingle file transfer")
else:
log.info("contacts does not support jingle file transfer")
gajim.connections[account].send_file_request(file_props)
return True

View File

@ -25,7 +25,7 @@ import message_control
from common import gajim
from common import helpers
from common.xmpp.protocol import NS_COMMANDS, NS_FILE, NS_MUC, NS_ESESSION
from common.xmpp.protocol import NS_COMMANDS, NS_FILE, NS_MUC, NS_ESESSION, NS_JINGLE_FILE_TRANSFER
def build_resources_submenu(contacts, account, action, room_jid=None,
room_account=None, cap=None):
@ -225,7 +225,7 @@ control=None):
else:
start_chat_menuitem.connect('activate',
gajim.interface.on_open_chat_window, contact, account)
if contact.supports(NS_FILE):
if contact.supports(NS_FILE) or contact.supports(NS_JINGLE_FILE_TRANSFER):
send_file_menuitem.set_sensitive(True)
send_file_menuitem.connect('activate',
roster.on_send_file_menuitem_activate, contact, account)