Mercurial > pidgin
comparison src/server.c @ 2372:2927c2c26fe6
[gaim-migrate @ 2385]
reformatting. nothing else.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 27 Sep 2001 19:17:11 +0000 |
parents | ad56a93661fc |
children | 427ccd7dfdd2 |
comparison
equal
deleted
inserted
replaced
2371:db02399a9ad7 | 2372:2927c2c26fe6 |
---|---|
160 | 160 |
161 | 161 |
162 void serv_set_away(struct gaim_connection *gc, char *state, char *message) | 162 void serv_set_away(struct gaim_connection *gc, char *state, char *message) |
163 { | 163 { |
164 if (gc && gc->prpl && gc->prpl->set_away) { | 164 if (gc && gc->prpl && gc->prpl->set_away) { |
165 char *buf=NULL; | 165 char *buf = NULL; |
166 if(message) { | 166 if (message) { |
167 buf = g_malloc(strlen(message)+1); | 167 buf = g_malloc(strlen(message) + 1); |
168 if(gc->prpl->options & OPT_PROTO_HTML) | 168 if (gc->prpl->options & OPT_PROTO_HTML) |
169 strncpy(buf, message, strlen(message)+1); | 169 strncpy(buf, message, strlen(message) + 1); |
170 else | 170 else |
171 strncpy_nohtml(buf, message, strlen(message)+1); | 171 strncpy_nohtml(buf, message, strlen(message) + 1); |
172 } | 172 } |
173 | 173 |
174 (*gc->prpl->set_away)(gc, state, buf); | 174 (*gc->prpl->set_away)(gc, state, buf); |
175 | 175 |
176 plugin_event(event_away, gc, state, buf, 0); | 176 plugin_event(event_away, gc, state, buf, 0); |
177 | 177 |
178 if(buf) | 178 if (buf) |
179 g_free(buf); | 179 g_free(buf); |
180 } | 180 } |
181 | 181 |
182 system_log(log_away, gc, NULL, OPT_LOG_BUDDY_AWAY | OPT_LOG_MY_SIGNON); | 182 system_log(log_away, gc, NULL, OPT_LOG_BUDDY_AWAY | OPT_LOG_MY_SIGNON); |
183 } | 183 } |
235 } | 235 } |
236 | 236 |
237 void serv_remove_buddies(struct gaim_connection *gc, GList *g) | 237 void serv_remove_buddies(struct gaim_connection *gc, GList *g) |
238 { | 238 { |
239 if (!gc->prpl) | 239 if (!gc->prpl) |
240 return; /* how the hell did that happen? */ | 240 return; /* how the hell did that happen? */ |
241 if (gc->prpl->remove_buddies) | 241 if (gc->prpl->remove_buddies) |
242 (*gc->prpl->remove_buddies)(gc, g); | 242 (*gc->prpl->remove_buddies)(gc, g); |
243 else { | 243 else { |
244 while (g) { | 244 while (g) { |
245 serv_remove_buddy(gc, g->data); | 245 serv_remove_buddy(gc, g->data); |
342 char *temp; | 342 char *temp; |
343 int i; | 343 int i; |
344 | 344 |
345 templist = message_queue; | 345 templist = message_queue; |
346 | 346 |
347 for (i = 0; i < GTK_CLIST(clistqueue)->rows; i++) | 347 for (i = 0; i < GTK_CLIST(clistqueue)->rows; i++) { |
348 { | |
349 gtk_clist_get_text(GTK_CLIST(clistqueue), i, 0, &temp); | 348 gtk_clist_get_text(GTK_CLIST(clistqueue), i, 0, &temp); |
350 | 349 |
351 if (!strcmp(name, temp)) | 350 if (!strcmp(name, temp)) |
352 return i; | 351 return i; |
353 } | 352 } |
364 | 363 |
365 while (templist) { | 364 while (templist) { |
366 struct queued_message *qm = (struct queued_message *)templist->data; | 365 struct queued_message *qm = (struct queued_message *)templist->data; |
367 if ((qm->flags & WFLAG_RECV) && !strcmp(name, qm->name)) | 366 if ((qm->flags & WFLAG_RECV) && !strcmp(name, qm->name)) |
368 i++; | 367 i++; |
369 | 368 |
370 templist = templist->next; | 369 templist = templist->next; |
371 } | 370 } |
372 | 371 |
373 return i; | 372 return i; |
374 } | 373 } |
380 | 379 |
381 templist = away_time_queue; | 380 templist = away_time_queue; |
382 | 381 |
383 while (templist) { | 382 while (templist) { |
384 qar = (struct queued_away_response *)templist->data; | 383 qar = (struct queued_away_response *)templist->data; |
385 | 384 |
386 if (!strcmp(name, qar->name)) | 385 if (!strcmp(name, qar->name)) |
387 return qar; | 386 return qar; |
388 | 387 |
389 templist = templist->next; | 388 templist = templist->next; |
390 } | 389 } |
531 } | 530 } |
532 if (new_conv && (sound_options & OPT_SOUND_FIRST_RCV)) | 531 if (new_conv && (sound_options & OPT_SOUND_FIRST_RCV)) |
533 play_sound(FIRST_RECEIVE); | 532 play_sound(FIRST_RECEIVE); |
534 else if (cnv->makesound && (sound_options & OPT_SOUND_RECV)) | 533 else if (cnv->makesound && (sound_options & OPT_SOUND_RECV)) |
535 play_sound(RECEIVE); | 534 play_sound(RECEIVE); |
536 | 535 |
537 write_to_conv(cnv, message, away | WFLAG_RECV, NULL, mtime); | 536 write_to_conv(cnv, message, away | WFLAG_RECV, NULL, mtime); |
538 } | 537 } |
539 | 538 |
540 /* regardless of whether we queue it or not, we should send an auto-response. That is, | 539 /* regardless of whether we queue it or not, we should send an auto-response. That is, |
541 * of course, unless the horse.... no wait. */ | 540 * of course, unless the horse.... no wait. */ |
575 qm->gc = gc; | 574 qm->gc = gc; |
576 qm->tm = mtime; | 575 qm->tm = mtime; |
577 qm->flags = WFLAG_SEND | WFLAG_AUTO; | 576 qm->flags = WFLAG_SEND | WFLAG_AUTO; |
578 message_queue = g_slist_append(message_queue, qm); | 577 message_queue = g_slist_append(message_queue, qm); |
579 } else if (cnv != NULL) | 578 } else if (cnv != NULL) |
580 write_to_conv(cnv, away_subs(tmpmsg, alias), WFLAG_SEND | WFLAG_AUTO, NULL, mtime); | 579 write_to_conv(cnv, away_subs(tmpmsg, alias), WFLAG_SEND | WFLAG_AUTO, NULL, |
580 mtime); | |
581 g_free(tmpmsg); | 581 g_free(tmpmsg); |
582 } else { | 582 } else { |
583 /* we're not away. this is easy. if the convo window doesn't exist, create and update | 583 /* we're not away. this is easy. if the convo window doesn't exist, create and update |
584 * it (if it does exist it was updated earlier), then play a sound indicating we've | 584 * it (if it does exist it was updated earlier), then play a sound indicating we've |
585 * received it and then display it. easy. */ | 585 * received it and then display it. easy. */ |
641 g_snprintf(cv->name, sizeof(cv->name), "%s", name); | 641 g_snprintf(cv->name, sizeof(cv->name), "%s", name); |
642 if (find_log_info(name) || (logging_options & OPT_LOG_ALL)) | 642 if (find_log_info(name) || (logging_options & OPT_LOG_ALL)) |
643 g_snprintf(who, 63, LOG_CONVERSATION_TITLE, name); | 643 g_snprintf(who, 63, LOG_CONVERSATION_TITLE, name); |
644 else | 644 else |
645 g_snprintf(who, 63, CONVERSATION_TITLE, name); | 645 g_snprintf(who, 63, CONVERSATION_TITLE, name); |
646 gtk_window_set_title(GTK_WINDOW(cv->window), who); | 646 gtk_window_set_title(GTK_WINDOW(cv->window), who); |
647 /* was g_free(buf), but break gives us that | 647 /* was g_free(buf), but break gives us that |
648 * and freeing twice is not good --Sumner */ | 648 * and freeing twice is not good --Sumner */ |
649 break; | 649 break; |
650 } | 650 } |
651 } | 651 } |
767 } | 767 } |
768 | 768 |
769 static void chat_invite_callback(GtkWidget *w, GtkWidget *w2) | 769 static void chat_invite_callback(GtkWidget *w, GtkWidget *w2) |
770 { | 770 { |
771 struct gaim_connection *g = (struct gaim_connection *) | 771 struct gaim_connection *g = (struct gaim_connection *) |
772 gtk_object_get_user_data(GTK_OBJECT(GTK_DIALOG(w2)->vbox)); | 772 gtk_object_get_user_data(GTK_OBJECT(GTK_DIALOG(w2)->vbox)); |
773 GList *str, *tmp; | 773 GList *str, *tmp; |
774 | 774 |
775 str = gtk_object_get_user_data(GTK_OBJECT(w2)); | 775 str = gtk_object_get_user_data(GTK_OBJECT(w2)); |
776 | 776 |
777 serv_join_chat(g, str); | 777 serv_join_chat(g, str); |
905 g->buddy_chats = g_slist_remove(g->buddy_chats, b); | 905 g->buddy_chats = g_slist_remove(g->buddy_chats, b); |
906 | 906 |
907 delete_chat(b); | 907 delete_chat(b); |
908 } | 908 } |
909 | 909 |
910 void serv_got_chat_in(struct gaim_connection *g, int id, char *who, int whisper, char *message, time_t mtime) | 910 void serv_got_chat_in(struct gaim_connection *g, int id, char *who, int whisper, char *message, |
911 time_t mtime) | |
911 { | 912 { |
912 int w; | 913 int w; |
913 GSList *bcs = g->buddy_chats; | 914 GSList *bcs = g->buddy_chats; |
914 struct conversation *b = NULL; | 915 struct conversation *b = NULL; |
915 char *buf; | 916 char *buf; |
924 } | 925 } |
925 if (!b) | 926 if (!b) |
926 return; | 927 return; |
927 | 928 |
928 if (plugin_event(event_chat_recv, g, (void *)b->id, who, message)) | 929 if (plugin_event(event_chat_recv, g, (void *)b->id, who, message)) |
929 return; | 930 return; |
930 | 931 |
931 buf = g_malloc(MAX(strlen(message) * 2, 8192)); | 932 buf = g_malloc(MAX(strlen(message) * 2, 8192)); |
932 strcpy(buf, message); | 933 strcpy(buf, message); |
933 | 934 |
934 if (convo_options & OPT_CONVO_SEND_LINKS) | 935 if (convo_options & OPT_CONVO_SEND_LINKS) |