Commit 071dcc00 authored by Tijmen de Mes's avatar Tijmen de Mes

Support 'messages' as preferred media for a contact

parent 39054b24
...@@ -1520,7 +1520,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin): ...@@ -1520,7 +1520,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
sliding_panels = True sliding_panels = True
__streamtypes__ = {'chat', 'screen-sharing', 'video', 'message'} # the stream types for which we show the chat window __streamtypes__ = {'chat', 'screen-sharing', 'video', 'messages'} # the stream types for which we show the chat window
def __init__(self, parent=None): def __init__(self, parent=None):
super(ChatWindow, self).__init__(parent) super(ChatWindow, self).__init__(parent)
......
...@@ -225,7 +225,7 @@ class PreferredMedia(str): ...@@ -225,7 +225,7 @@ class PreferredMedia(str):
@property @property
def autoconnect(self): def autoconnect(self):
return self != 'chat' return self != 'chat' and self != 'messages'
class BonjourNeighbourID(str): class BonjourNeighbourID(str):
...@@ -3516,7 +3516,7 @@ class ContactListView(QListView): ...@@ -3516,7 +3516,7 @@ class ContactListView(QListView):
def _AH_SendSMS(self, uri=None): def _AH_SendSMS(self, uri=None):
contact = self.selectionModel().selectedIndexes()[0].data(Qt.UserRole) contact = self.selectionModel().selectedIndexes()[0].data(Qt.UserRole)
session_manager = SessionManager() session_manager = SessionManager()
session_manager.create_session(contact, uri or contact.uri, [StreamDescription('message')], connect=False) session_manager.create_session(contact, uri or contact.uri, [StreamDescription('messages')], connect=False)
def _AH_SendFiles(self, uri=None): def _AH_SendFiles(self, uri=None):
session_manager = SessionManager() session_manager = SessionManager()
...@@ -3908,7 +3908,7 @@ class ContactSearchListView(QListView): ...@@ -3908,7 +3908,7 @@ class ContactSearchListView(QListView):
def _AH_SendSMS(self, uri=None): def _AH_SendSMS(self, uri=None):
contact = self.selectionModel().selectedIndexes()[0].data(Qt.UserRole) contact = self.selectionModel().selectedIndexes()[0].data(Qt.UserRole)
session_manager = SessionManager() session_manager = SessionManager()
session_manager.create_session(contact, uri or contact.uri, [StreamDescription('message')], connect=False) session_manager.create_session(contact, uri or contact.uri, [StreamDescription('messages')], connect=False)
def _AH_SendFiles(self, uri=None): def _AH_SendFiles(self, uri=None):
session_manager = SessionManager() session_manager = SessionManager()
...@@ -4218,7 +4218,7 @@ class ContactDetailView(QListView): ...@@ -4218,7 +4218,7 @@ class ContactDetailView(QListView):
else: else:
selected_uri = uri or contact.uri selected_uri = uri or contact.uri
session_manager = SessionManager() session_manager = SessionManager()
session_manager.create_session(contact, selected_uri, [StreamDescription('message')], connect=False) session_manager.create_session(contact, selected_uri, [StreamDescription('messages')], connect=False)
def _AH_SendFiles(self, uri=None): def _AH_SendFiles(self, uri=None):
session_manager = SessionManager() session_manager = SessionManager()
...@@ -4649,6 +4649,7 @@ class ContactEditorDialog(base_class, ui_class): ...@@ -4649,6 +4649,7 @@ class ContactEditorDialog(base_class, ui_class):
self.preferred_media.setItemData(1, 'video') self.preferred_media.setItemData(1, 'video')
self.preferred_media.setItemData(2, 'chat') self.preferred_media.setItemData(2, 'chat')
self.preferred_media.setItemData(3, 'audio+chat') self.preferred_media.setItemData(3, 'audio+chat')
self.preferred_media.setItemData(4, 'messages')
self.addresses_table.verticalHeader().setDefaultSectionSize(URITypeComboBox().sizeHint().height()) self.addresses_table.verticalHeader().setDefaultSectionSize(URITypeComboBox().sizeHint().height())
def open_for_add(self, sip_address='', target_group=None): def open_for_add(self, sip_address='', target_group=None):
...@@ -4766,6 +4767,7 @@ class ContactEditorDialog(base_class, ui_class): ...@@ -4766,6 +4767,7 @@ class ContactEditorDialog(base_class, ui_class):
if 'icon' in modified_attributes: if 'icon' in modified_attributes:
self.icon_selector.update_from_contact(contact) self.icon_selector.update_from_contact(contact)
del ui_class, base_class del ui_class, base_class
......
...@@ -572,7 +572,7 @@ class MainWindow(base_class, ui_class): ...@@ -572,7 +572,7 @@ class MainWindow(base_class, ui_class):
else: else:
contact, contact_uri = URIUtils.find_contact(self.search_box.text()) contact, contact_uri = URIUtils.find_contact(self.search_box.text())
session_manager = SessionManager() session_manager = SessionManager()
session_manager.create_session(contact, contact_uri, [StreamDescription('message')], connect=False) session_manager.create_session(contact, contact_uri, [StreamDescription('messages')], connect=False)
def _AH_RequestScreenActionTriggered(self): def _AH_RequestScreenActionTriggered(self):
list_view = self.contact_list if self.contacts_view.currentWidget() is self.contact_list_panel else self.search_list list_view = self.contact_list if self.contacts_view.currentWidget() is self.contact_list_panel else self.search_list
......
...@@ -219,7 +219,7 @@ class MessageManager(object, metaclass=Singleton): ...@@ -219,7 +219,7 @@ class MessageManager(object, metaclass=Singleton):
if content_type.lower() in [IsComposingDocument.content_type, IMDNDocument.content_type]: if content_type.lower() in [IsComposingDocument.content_type, IMDNDocument.content_type]:
return return
else: else:
blink_session = session_manager.create_session(contact, contact_uri, [StreamDescription('message')], account=account, connect=False) blink_session = session_manager.create_session(contact, contact_uri, [StreamDescription('messages')], account=account, connect=False)
if content_type.lower() == IsComposingDocument.content_type: if content_type.lower() == IsComposingDocument.content_type:
try: try:
......
...@@ -248,6 +248,11 @@ ...@@ -248,6 +248,11 @@
<string>Start voice + chat sessions by default</string> <string>Start voice + chat sessions by default</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Start message sessions by default</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment