diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java index 7a2dec231..c99297c90 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java @@ -1209,13 +1209,16 @@ public void sendSmsMessage() */ protected void sendInstantMessage() { - String htmlText = getTextFromWriteArea("text/html"); + String htmlText = getTextFromWriteArea( + OperationSetBasicInstantMessaging.HTML_MIME_TYPE); String plainText = getTextFromWriteArea( OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE); String messageText; String mimeType; - if ( (htmlText.indexOf(" -1 + if (chatSession.getCurrentChatTransport().isContentTypeSupported( + OperationSetBasicInstantMessaging.HTML_MIME_TYPE) + && (htmlText.indexOf(" -1 || htmlText.indexOf(" -1 || htmlText.indexOf(" -1 || htmlText.indexOf(" -1)) diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatTransport.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatTransport.java index c6148d755..3fe725826 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatTransport.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatTransport.java @@ -101,6 +101,15 @@ public void sendInstantMessage( String message, String mimeType) throws Exception; + /** + * Determines whether this chat transport supports the supplied content type + * + * @param contentType the type we want to check + * @return true if the chat transport supports it and + * false otherwise. + */ + public boolean isContentTypeSupported(String contentType); + /** * Sends the given SMS message trough this chat transport. * diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatTransport.java b/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatTransport.java index f24cbf9d2..6e6a907ed 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatTransport.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/MetaContactChatTransport.java @@ -241,6 +241,26 @@ public void sendInstantMessage( String message, imOpSet.sendInstantMessage(contact, msg); } + /** + * Determines whether this chat transport supports the supplied content type + * + * @param contentType the type we want to check + * @return true if the chat transport supports it and + * false otherwise. + */ + public boolean isContentTypeSupported(String contentType) + { + OperationSetBasicInstantMessaging imOpSet + = contact + .getProtocolProvider() + .getOperationSet(OperationSetBasicInstantMessaging.class); + + if(imOpSet != null) + return imOpSet.isContentTypeSupported(contentType); + else + return false; + } + /** * Sends the given sms message trough this chat transport. * diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/AdHocConferenceChatTransport.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/AdHocConferenceChatTransport.java index 799649795..38e86f9ae 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/AdHocConferenceChatTransport.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/AdHocConferenceChatTransport.java @@ -152,6 +152,20 @@ public void sendInstantMessage(String messageText, String mimeType) adHocChatRoom.sendMessage(message); } + /** + * Determines whether this chat transport supports the supplied content type + * + * @param contentType the type we want to check + * @return true if the chat transport supports it and + * false otherwise. + */ + public boolean isContentTypeSupported(String contentType) + { + // we only support plain text for chat rooms for now + return OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE + .equals(contentType); + } + /** * Sending sms messages is not supported by this chat transport * implementation. diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatTransport.java b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatTransport.java index eceec6616..0ab96b724 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatTransport.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/conference/ConferenceChatTransport.java @@ -151,6 +151,20 @@ public void sendInstantMessage(String messageText, String mimeType) chatRoom.sendMessage(message); } + /** + * Determines whether this chat transport supports the supplied content type + * + * @param contentType the type we want to check + * @return true if the chat transport supports it and + * false otherwise. + */ + public boolean isContentTypeSupported(String contentType) + { + // we only support plain text for chat rooms for now + return OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE + .equals(contentType); + } + /** * Sending sms messages is not supported by this chat transport * implementation.