diff --git a/resources/images/images.properties b/resources/images/images.properties index f9ea95a71..68e3ffe2f 100644 --- a/resources/images/images.properties +++ b/resources/images/images.properties @@ -174,6 +174,9 @@ service.gui.buttons.ADD_CONTACT_BUTTON_SMALL_ROLLOVER=resources/images/impl/gui/ service.gui.buttons.WEB_BUTTON=resources/images/impl/gui/buttons/webButton.png service.gui.buttons.WEB_BUTTON_PRESSED=resources/images/impl/gui/buttons/webButtonPressed.png service.gui.buttons.WEB_BUTTON_ROLLOVER=resources/images/impl/gui/buttons/webButtonSelected.png +service.gui.buttons.SMS_BUTTON=resources/images/impl/gui/buttons/smsButton.png +service.gui.buttons.SMS_BUTTON_PRESSED=resources/images/impl/gui/buttons/smsButtonPressed.png +service.gui.buttons.SMS_BUTTON_ROLLOVER=resources/images/impl/gui/buttons/smsButtonSelected.png service.gui.buttons.HANGUP_BUTTON_BG=resources/images/impl/gui/buttons/hangupButton.png service.gui.buttons.HANGUP_BUTTON_ROLLOVER=resources/images/impl/gui/buttons/hangupButtonRollover.png service.gui.buttons.HANGUP_BUTTON_PRESSED=resources/images/impl/gui/buttons/hangupButtonPressed.png diff --git a/resources/images/impl/gui/buttons/smsButton.png b/resources/images/impl/gui/buttons/smsButton.png new file mode 100644 index 000000000..8f6d64915 Binary files /dev/null and b/resources/images/impl/gui/buttons/smsButton.png differ diff --git a/resources/images/impl/gui/buttons/smsButtonPressed.png b/resources/images/impl/gui/buttons/smsButtonPressed.png new file mode 100644 index 000000000..8879e72b7 Binary files /dev/null and b/resources/images/impl/gui/buttons/smsButtonPressed.png differ diff --git a/resources/images/impl/gui/buttons/smsButtonSelected.png b/resources/images/impl/gui/buttons/smsButtonSelected.png new file mode 100644 index 000000000..bd71f7cd5 Binary files /dev/null and b/resources/images/impl/gui/buttons/smsButtonSelected.png differ diff --git a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java index 5dfa0d2c2..02771597a 100644 --- a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java +++ b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java @@ -1538,9 +1538,21 @@ public void createCall(String[] participants) * @see UIService#startChat(String[]) */ public void startChat(String[] participants) + { + startChat(participants, false); + } + + /** + * Starts a new Chat with a specific set of participants. + * + * @param participants an array of String values specifying the + * participants to be included into the newly created Chat + * @param isSmsEnabled whether sms option should be enabled if possible + */ + public void startChat(String[] participants, boolean isSmsEnabled) { if (participants.length == 1) - getChatWindowManager().startChat(participants[0]); + getChatWindowManager().startChat(participants[0], isSmsEnabled); else throw new IllegalArgumentException("participants"); } 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 df4ab8856..88a0fb10e 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 @@ -921,6 +921,11 @@ public void startChat( MetaContact metaContact, } public void startChat(String contactString) + { + startChat(contactString, false); + } + + public void startChat(String contactString, boolean isSmsEnabled) { List imProviders = AccountUtils.getRegisteredProviders( @@ -965,7 +970,34 @@ public void startChat(String contactString) } } if (startChat) - startChat(metaContact, contact, false); + startChat(metaContact, contact, isSmsEnabled); + else if(isSmsEnabled) + { + // nothing found but we want to send sms, lets check and create + // the contact as it may not exist + List smsProviders + = AccountUtils.getRegisteredProviders( + OperationSetSmsMessaging.class); + + if(smsProviders == null || smsProviders.size() == 0) + return; + + OperationSetSmsMessaging smsOpSet + = smsProviders.get(0) + .getOperationSet(OperationSetSmsMessaging.class); + + contact = smsOpSet.getContact(contactString); + + if (contact != null) + { + metaContact + = metaContactListService.findMetaContactByContact(contact); + if (metaContact != null) + { + startChat(metaContact, contact, isSmsEnabled); + } + } + } } /** diff --git a/src/net/java/sip/communicator/service/gui/UIService.java b/src/net/java/sip/communicator/service/gui/UIService.java index 549941df6..d4b0b31cf 100644 --- a/src/net/java/sip/communicator/service/gui/UIService.java +++ b/src/net/java/sip/communicator/service/gui/UIService.java @@ -453,6 +453,15 @@ public SecurityAuthority getDefaultSecurityAuthority( */ public void startChat(String[] participants); + /** + * Starts a new Chat with a specific set of participants. + * + * @param participants an array of String values specifying the + * participants to be included into the newly created Chat + * @param isSmsEnabled whether sms option should be enabled if possible + */ + public void startChat(String[] participants, boolean isSmsEnabled); + /** * Creates a contact list component. *