diff options
author | Marin Dzhigarov <m.dzhigarov@gmail.com> | 2014-09-24 19:16:26 +0300 |
---|---|---|
committer | mdzhigarov <m.dzhigarov@gmail.com> | 2014-09-24 20:54:14 +0300 |
commit | 6a23358a8d280aaeba42e6ee82e5740973a2499f (patch) | |
tree | 4050d8f09e2c04e9e0455f6cad1cb48ff6b7dd31 /src | |
parent | 7177a5b243730b069053f255563033a6b52f6d3d (diff) | |
download | jitsi-6a23358a8d280aaeba42e6ee82e5740973a2499f.zip jitsi-6a23358a8d280aaeba42e6ee82e5740973a2499f.tar.gz jitsi-6a23358a8d280aaeba42e6ee82e5740973a2499f.tar.bz2 |
Adds support for sending instant messages to external contacts
Signed-off-by: mdzhigarov <m.dzhigarov@gmail.com>
Diffstat (limited to 'src')
6 files changed, 76 insertions, 17 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindowManager.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindowManager.java index 41790c8..4ffdb21 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindowManager.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindowManager.java @@ -999,6 +999,20 @@ public class ChatWindowManager break; } } + else + { + contact = + presenceOpSet.createUnresolvedContact( + contactString, null); + metaContact = + metaContactListService.findMetaContactByContact( + contact); + if (metaContact != null) + { + startChat = true; + break; + } + } } } catch (Throwable t) diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPane.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPane.java index 6deddaf..03890c6 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPane.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPane.java @@ -232,8 +232,13 @@ public class ContactListPane = imDetails.get(0).getPreferredProtocolProvider( OperationSetBasicInstantMessaging.class); - GuiActivator.getUIService().getChatWindowManager() - .startChat(contact.getContactAddress(), pps); + if (pps != null) + GuiActivator.getUIService().getChatWindowManager() + .startChat(contact.getContactAddress(), + pps); + else + GuiActivator.getUIService().getChatWindowManager() + .startChat(contact.getContactAddress()); } else if(mucDetails != null && mucDetails.size() > 0) { diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java index d99b235..8384309 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java @@ -358,9 +358,13 @@ public class ContactListTreeCellRenderer = imDetails.get(0).getPreferredProtocolProvider( OperationSetBasicInstantMessaging.class); - GuiActivator.getUIService().getChatWindowManager() - .startChat(contact.getContactAddress(), - pps); + if (pps != null) + GuiActivator.getUIService().getChatWindowManager() + .startChat(contact.getContactAddress(), + pps); + else + GuiActivator.getUIService().getChatWindowManager() + .startChat(contact.getContactAddress()); } else if(mucDetails != null && mucDetails.size() > 0) { @@ -990,9 +994,8 @@ public class ContactListTreeCellRenderer return; UIContactDetail imContact = null; - // For now we support instance messaging only for contacts in our - // contact list until it's implemented for external source contacts. - if (uiContact.getDescriptor() instanceof MetaContact) + if (uiContact.getDescriptor() instanceof MetaContact || + uiContact.getDescriptor() instanceof SourceContact) imContact = uiContact.getDefaultContactDetail( OperationSetBasicInstantMessaging.class); diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/SourceContactRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/SourceContactRightButtonMenu.java index 06d5705..606d5c3 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/SourceContactRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/SourceContactRightButtonMenu.java @@ -56,14 +56,14 @@ public class SourceContactRightButtonMenu private SIPCommMenu callContactMenu; /** - * Contact details menu. - */ - private SIPCommMenu contactDetailsMenu; - - /** * Add contact component. */ private Component addContactComponent; + + /** + * The send message menu item. + */ + private JMenuItem sendMessageItem; /** * Creates an instance of <tt>SourceContactRightButtonMenu</tt> by @@ -102,10 +102,12 @@ public class SourceContactRightButtonMenu { addContactComponent = TreeContactList.createAddContactMenu(sourceContact); + initSendMessageMenu(); } if (addContactComponent != null) add(addContactComponent); + for(JMenuItem item : sourceUIContact.getContactCustomActionMenuItems(true)) @@ -115,6 +117,32 @@ public class SourceContactRightButtonMenu } /** + * Initialized the send message menu. + */ + private void initSendMessageMenu() + { + sendMessageItem = + new JMenuItem(GuiActivator.getResources() + .getI18NString("service.gui.SEND_MESSAGE")); + sendMessageItem.setName("sendMessage"); + sendMessageItem.setMnemonic( + GuiActivator.getResources() + .getI18nMnemonic("service.gui.SEND_MESSAGE")); + sendMessageItem.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.SEND_MESSAGE_16x16_ICON))); + sendMessageItem.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) + { + GuiActivator.getUIService().getChatWindowManager() + .startChat(sourceContact.getContactAddress()); + } + }); + add(sendMessageItem); + } + + /** * Initializes the call menu. * @return the call menu */ @@ -234,6 +262,9 @@ public class SourceContactRightButtonMenu { callContactMenu.setIcon(new ImageIcon(ImageLoader .getImage(ImageLoader.CALL_16x16_ICON))); + + sendMessageItem.setIcon(new ImageIcon( + ImageLoader.getImage(ImageLoader.SEND_MESSAGE_16x16_ICON))); if(addContactComponent instanceof JMenuItem) { @@ -241,4 +272,4 @@ public class SourceContactRightButtonMenu .getImage(ImageLoader.ADD_CONTACT_16x16_ICON))); } } -} +}
\ No newline at end of file diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java index bde4b00..8608031 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/TreeContactList.java @@ -1944,8 +1944,13 @@ public class TreeContactList = imDetails.get(0).getPreferredProtocolProvider( OperationSetBasicInstantMessaging.class); - GuiActivator.getUIService().getChatWindowManager() - .startChat(contact.getContactAddress(), pps); + if (pps != null) + GuiActivator.getUIService().getChatWindowManager() + .startChat(contact.getContactAddress(), + pps); + else + GuiActivator.getUIService().getChatWindowManager() + .startChat(contact.getContactAddress()); } else if(mucDetails != null && mucDetails.size() > 0) { diff --git a/src/net/java/sip/communicator/plugin/usersearch/UserSearchQuery.java b/src/net/java/sip/communicator/plugin/usersearch/UserSearchQuery.java index 0ba1fcb..b279499 100644 --- a/src/net/java/sip/communicator/plugin/usersearch/UserSearchQuery.java +++ b/src/net/java/sip/communicator/plugin/usersearch/UserSearchQuery.java @@ -106,8 +106,9 @@ public class UserSearchQuery return; List<Class<? extends OperationSet>> supportedOpSets - = new ArrayList<Class<? extends OperationSet>>(1); + = new ArrayList<Class<? extends OperationSet>>(2); supportedOpSets.add(OperationSetPersistentPresence.class); + supportedOpSets.add(OperationSetBasicInstantMessaging.class); ContactDetail detail = new ContactDetail(queryString); |