Mercurial > pidgin.yaz
comparison src/protocols/simple/simple.c @ 13092:edef744647ff
[gaim-migrate @ 15454]
a little leak fix
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 02 Feb 2006 04:50:55 +0000 |
parents | a91a8a28f61f |
children | d0ae6489a0fb |
comparison
equal
deleted
inserted
replaced
13091:7aea8de78463 | 13092:edef744647ff |
---|---|
151 } | 151 } |
152 return NULL; | 152 return NULL; |
153 } | 153 } |
154 | 154 |
155 static struct simple_watcher *watcher_create(struct simple_account_data *sip, gchar *name, gchar *callid, gchar *ourtag, gchar *theirtag) { | 155 static struct simple_watcher *watcher_create(struct simple_account_data *sip, gchar *name, gchar *callid, gchar *ourtag, gchar *theirtag) { |
156 struct simple_watcher *watcher = g_new0(struct simple_watcher,1); | 156 struct simple_watcher *watcher = g_new0(struct simple_watcher, 1); |
157 watcher->name = g_strdup(name); | 157 watcher->name = g_strdup(name); |
158 watcher->dialog.callid = g_strdup(callid); | 158 watcher->dialog.callid = g_strdup(callid); |
159 watcher->dialog.ourtag = g_strdup(ourtag); | 159 watcher->dialog.ourtag = g_strdup(ourtag); |
160 watcher->dialog.theirtag = g_strdup(theirtag); | 160 watcher->dialog.theirtag = g_strdup(theirtag); |
161 sip->watcher = g_slist_append(sip->watcher, watcher); | 161 sip->watcher = g_slist_append(sip->watcher, watcher); |
487 static void send_sip_response(GaimConnection *gc, struct sipmsg *msg, int code, char *text, char *body) { | 487 static void send_sip_response(GaimConnection *gc, struct sipmsg *msg, int code, char *text, char *body) { |
488 GSList *tmp = msg->headers; | 488 GSList *tmp = msg->headers; |
489 gchar *name; | 489 gchar *name; |
490 gchar *value; | 490 gchar *value; |
491 GString *outstr = g_string_new(""); | 491 GString *outstr = g_string_new(""); |
492 | 492 |
493 /* When sending the acknowlegements and errors, the content length from the original | 493 /* When sending the acknowlegements and errors, the content length from the original |
494 message is still here, but there is no body; we need to make sure we're sending the | 494 message is still here, but there is no body; we need to make sure we're sending the |
495 correct content length */ | 495 correct content length */ |
496 sipmsg_remove_header(msg, "Content-Length"); | 496 sipmsg_remove_header(msg, "Content-Length"); |
497 if(body) { | 497 if(body) { |
545 return (struct transaction *)NULL; | 545 return (struct transaction *)NULL; |
546 } | 546 } |
547 | 547 |
548 static void send_sip_request(GaimConnection *gc, gchar *method, gchar *url, gchar *to, gchar *addheaders, gchar *body, struct sip_dialog *dialog, TransCallback tc) { | 548 static void send_sip_request(GaimConnection *gc, gchar *method, gchar *url, gchar *to, gchar *addheaders, gchar *body, struct sip_dialog *dialog, TransCallback tc) { |
549 struct simple_account_data *sip = gc->proto_data; | 549 struct simple_account_data *sip = gc->proto_data; |
550 char *callid= dialog ? g_strdup(dialog->callid) : gencallid(); | 550 char *callid = dialog ? g_strdup(dialog->callid) : gencallid(); |
551 char *auth=""; | 551 char *auth = ""; |
552 char *addh=""; | 552 char *addh = ""; |
553 gchar *branch = genbranch(); | 553 gchar *branch = genbranch(); |
554 char *buf; | 554 char *buf; |
555 | 555 |
556 if(!strcmp(method,"REGISTER")) { | 556 if(!strcmp(method,"REGISTER")) { |
557 if(sip->regcallid) callid = g_strdup(sip->regcallid); | 557 if(sip->regcallid) { |
558 g_free(callid); | |
559 callid = g_strdup(sip->regcallid); | |
560 } | |
558 else sip->regcallid = g_strdup(callid); | 561 else sip->regcallid = g_strdup(callid); |
559 } | 562 } |
560 | 563 |
561 if(addheaders) addh=addheaders; | 564 if(addheaders) addh = addheaders; |
562 if(sip->registrar.type && !strcmp(method,"REGISTER")) { | 565 if(sip->registrar.type && !strcmp(method,"REGISTER")) { |
563 buf = auth_header(sip, &sip->registrar, method, url); | 566 buf = auth_header(sip, &sip->registrar, method, url); |
564 auth = g_strdup_printf("Authorization: %s", buf); | 567 auth = g_strdup_printf("Authorization: %s", buf); |
565 g_free(buf); | 568 g_free(buf); |
566 gaim_debug(GAIM_DEBUG_MISC, "simple", "header %s", auth); | 569 gaim_debug(GAIM_DEBUG_MISC, "simple", "header %s", auth); |
1210 } | 1213 } |
1211 | 1214 |
1212 sip->fd = source; | 1215 sip->fd = source; |
1213 | 1216 |
1214 conn = connection_create(sip, source); | 1217 conn = connection_create(sip, source); |
1215 | 1218 |
1216 sip->registertimeout = gaim_timeout_add((rand()%100)+10*1000, (GSourceFunc)subscribe_timeout, sip); | 1219 sip->registertimeout = gaim_timeout_add((rand()%100)+10*1000, (GSourceFunc)subscribe_timeout, sip); |
1217 | 1220 |
1218 do_register(sip); | 1221 do_register(sip); |
1219 | 1222 |
1220 conn->inputhandler = gaim_input_add(sip->fd, GAIM_INPUT_READ, simple_input_cb, gc); | 1223 conn->inputhandler = gaim_input_add(sip->fd, GAIM_INPUT_READ, simple_input_cb, gc); |