Only allow using XHTML if the receiver supports it.
This commit is contained in:
parent
0b93973c46
commit
a1c1163d16
|
@ -49,8 +49,8 @@ from common.contacts import GC_Contact
|
|||
from common.logger import Constants
|
||||
constants = Constants()
|
||||
from common.pep import MOODS, ACTIVITIES
|
||||
from common.xmpp.protocol import NS_XHTML, NS_FILE, NS_MUC, NS_RECEIPTS
|
||||
from common.xmpp.protocol import NS_ESESSION
|
||||
from common.xmpp.protocol import NS_XHTML, NS_XHTML_IM, NS_FILE, NS_MUC
|
||||
from common.xmpp.protocol import NS_RECEIPTS, NS_ESESSION
|
||||
|
||||
try:
|
||||
import gtkspell
|
||||
|
@ -1061,13 +1061,18 @@ class ChatControlBase(MessageControl):
|
|||
def got_connected(self):
|
||||
self.msg_textview.set_sensitive(True)
|
||||
self.msg_textview.set_editable(True)
|
||||
# FIXME: This seems wrong. What if we have caps?
|
||||
self.xml.get_widget('formattings_button').set_sensitive(True)
|
||||
self.xml.get_widget('send_button').set_sensitive(True)
|
||||
self.xml.get_widget('convert_to_gc_button').set_sensitive(True)
|
||||
|
||||
def got_disconnected(self):
|
||||
self.msg_textview.set_sensitive(False)
|
||||
self.msg_textview.set_editable(False)
|
||||
self.conv_textview.tv.grab_focus()
|
||||
self.xml.get_widget('formattings_button').set_sensitive(False)
|
||||
self.xml.get_widget('send_button').set_sensitive(False)
|
||||
self.xml.get_widget('convert_to_gc_button').set_sensitive(False)
|
||||
|
||||
################################################################################
|
||||
class ChatControl(ChatControlBase):
|
||||
|
@ -1086,6 +1091,8 @@ class ChatControl(ChatControlBase):
|
|||
id = self.actions_button.connect('clicked', self.on_actions_button_clicked)
|
||||
self.handlers[id] = self.actions_button
|
||||
|
||||
self._formattings_button = self.xml.get_widget('formattings_button')
|
||||
|
||||
self._add_to_roster_button = self.xml.get_widget(
|
||||
'add_to_roster_button')
|
||||
id = self._add_to_roster_button.connect('clicked',
|
||||
|
@ -1232,6 +1239,12 @@ class ChatControl(ChatControlBase):
|
|||
self.msg_textview.grab_focus()
|
||||
|
||||
def update_toolbar(self):
|
||||
# Formatting
|
||||
if gajim.capscache.is_supported(self.contact, NS_XHTML_IM):
|
||||
self._formattings_button.set_sensitive(True)
|
||||
else:
|
||||
self._formattings_button.set_sensitive(False)
|
||||
|
||||
# Add to roster
|
||||
if not isinstance(self.contact, GC_Contact) \
|
||||
and _('Not in Roster') in self.contact.groups:
|
||||
|
|
Loading…
Reference in New Issue