comparison src/protocols/simple/simple.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 2f379ed0c26b
children cfc808463763
comparison
equal deleted inserted replaced
12215:31b91bfab029 12216:4d3119205a33
492 } 492 }
493 493
494 static void send_sip_request(GaimConnection *gc, gchar *method, gchar *url, gchar *to, gchar *addheaders, gchar *body, struct sip_dialog *dialog, TransCallback tc) { 494 static void send_sip_request(GaimConnection *gc, gchar *method, gchar *url, gchar *to, gchar *addheaders, gchar *body, struct sip_dialog *dialog, TransCallback tc) {
495 struct simple_account_data *sip = gc->proto_data; 495 struct simple_account_data *sip = gc->proto_data;
496 char *callid= dialog ? g_strdup(dialog->callid) : gencallid(); 496 char *callid= dialog ? g_strdup(dialog->callid) : gencallid();
497 if(!strcmp(method,"REGISTER")) {
498 if(sip->regcallid) callid = g_strdup(sip->regcallid);
499 else sip->regcallid = g_strdup(callid);
500 }
501 char *auth=""; 497 char *auth="";
502 char *addh=""; 498 char *addh="";
503 gchar *branch = genbranch(); 499 gchar *branch = genbranch();
504 char *buf; 500 char *buf;
501
502 if(!strcmp(method,"REGISTER")) {
503 if(sip->regcallid) callid = g_strdup(sip->regcallid);
504 else sip->regcallid = g_strdup(callid);
505 }
505 506
506 if(addheaders) addh=addheaders; 507 if(addheaders) addh=addheaders;
507 if(sip->registrar.type && !strcmp(method,"REGISTER")) { 508 if(sip->registrar.type && !strcmp(method,"REGISTER")) {
508 buf = auth_header(sip, &sip->registrar, method, url); 509 buf = auth_header(sip, &sip->registrar, method, url);
509 auth = g_strdup_printf("Authorization: %s",buf); 510 auth = g_strdup_printf("Authorization: %s",buf);
711 } 712 }
712 send_sip_request(sip->gc, "MESSAGE", to, to, hdr, msg, NULL, NULL); 713 send_sip_request(sip->gc, "MESSAGE", to, to, hdr, msg, NULL, NULL);
713 g_free(hdr); 714 g_free(hdr);
714 } 715 }
715 716
716 static int simple_im_send(GaimConnection *gc, const char *who, const char *what, GaimConvImFlags flags) { 717 static int simple_im_send(GaimConnection *gc, const char *who, const char *what, GaimMessageFlags flags) {
717 struct simple_account_data *sip = gc->proto_data; 718 struct simple_account_data *sip = gc->proto_data;
718 char *to = g_strdup(who); 719 char *to = g_strdup(who);
719 char *text = g_strdup(what); 720 char *text = gaim_unescape_html(what);
720 simple_send_message(sip, to, text, NULL); 721 simple_send_message(sip, to, text, NULL);
721 g_free(to); 722 g_free(to);
722 g_free(text); 723 g_free(text);
723 return 1; 724 return 1;
724 } 725 }