comparison src/protocols/sametime/sametime.c @ 12216:4d3119205a33

[gaim-migrate @ 14518] Remove GaimConvImFlags and GaimConvChatFlags - use GaimMessageFlags everywhere instead. Add a new GAIM_MESSAGE_IMAGES flag, and set it when sending a message containing images. When sending a message, the core will now always send "html" to the prpls, just like it expects to receive html from the prpls for received messages. This will allow text prpls such as SILC to support IM images and differentiate them from user input. Previously gaim_unescape_html() was used before passing the message to the prpl, now the prpl does this itself if it needs it. I think I updated all the prpls correctly, but I'm not so sure about sametime. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Thu, 24 Nov 2005 20:47:46 +0000
parents d6417efb990c
children 8190a70d2c34
comparison
equal deleted inserted replaced
12215:31b91bfab029 12216:4d3119205a33
3906 3906
3907 3907
3908 static int mw_prpl_send_im(GaimConnection *gc, 3908 static int mw_prpl_send_im(GaimConnection *gc,
3909 const char *name, 3909 const char *name,
3910 const char *message, 3910 const char *message,
3911 GaimConvImFlags flags) { 3911 GaimMessageFlags flags) {
3912 3912
3913 struct mwGaimPluginData *pd; 3913 struct mwGaimPluginData *pd;
3914 struct mwIdBlock who = { (char *) name, NULL }; 3914 struct mwIdBlock who = { (char *) name, NULL };
3915 struct mwConversation *conv; 3915 struct mwConversation *conv;
3916 3916
3928 result is that it may be possible that the other side of the 3928 result is that it may be possible that the other side of the
3929 conversation will receive a plaintext message with html contents, 3929 conversation will receive a plaintext message with html contents,
3930 which is bad. I'm not sure how to fix this correctly. */ 3930 which is bad. I'm not sure how to fix this correctly. */
3931 3931
3932 if(strstr(message, "<img ") || strstr(message, "<IMG ")) 3932 if(strstr(message, "<img ") || strstr(message, "<IMG "))
3933 flags |= GAIM_CONV_IM_IMAGES; 3933 flags |= GAIM_MESSAGE_IMAGES;
3934 3934
3935 if(mwConversation_isOpen(conv)) { 3935 if(mwConversation_isOpen(conv)) {
3936 char *tmp; 3936 char *tmp;
3937 int ret; 3937 int ret;
3938 3938
3939 if((flags & GAIM_CONV_IM_IMAGES) && 3939 if((flags & GAIM_MESSAGE_IMAGES) &&
3940 mwConversation_supports(conv, mwImSend_MIME)) { 3940 mwConversation_supports(conv, mwImSend_MIME)) {
3941 /* send a MIME message */ 3941 /* send a MIME message */
3942 3942
3943 tmp = im_mime_convert(gc, conv, message); 3943 tmp = im_mime_convert(gc, conv, message);
3944 ret = mwConversation_send(conv, mwImSend_MIME, tmp); 3944 ret = mwConversation_send(conv, mwImSend_MIME, tmp);
3962 ret = mwConversation_send(conv, mwImSend_HTML, tmp); 3962 ret = mwConversation_send(conv, mwImSend_HTML, tmp);
3963 g_free(tmp); 3963 g_free(tmp);
3964 3964
3965 } else { 3965 } else {
3966 /* default to text */ 3966 /* default to text */
3967 ret = mwConversation_send(conv, mwImSend_PLAIN, message); 3967 tmp = gaim_unescape_html(message);
3968 ret = mwConversation_send(conv, mwImSend_PLAIN, tmp);
3969 g_free(tmp);
3968 } 3970 }
3969 3971
3970 return !ret; 3972 return !ret;
3971 3973
3972 } else { 3974 } else {
4795 } 4797 }
4796 4798
4797 4799
4798 static int mw_prpl_chat_send(GaimConnection *gc, 4800 static int mw_prpl_chat_send(GaimConnection *gc,
4799 int id, 4801 int id,
4800 const char *message) { 4802 const char *message,
4803 GaimMessageFlags flags) {
4801 4804
4802 struct mwGaimPluginData *pd; 4805 struct mwGaimPluginData *pd;
4803 struct mwConference *conf; 4806 struct mwConference *conf;
4804 4807
4805 pd = gc->proto_data; 4808 pd = gc->proto_data;