comparison src/server.c @ 472:6a92cd7322cc

[gaim-migrate @ 482] merged chat and IM windows. /me is now in IM, font/color dialogs in chat, and smileys in chat too. also, fixed the GOOD bug. i don't know what kind of crack rob was smoking when he decided O could be eyes. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 09 Jul 2000 23:19:21 +0000
parents 5db3734a1fe6
children 6e318907bcce
comparison
equal deleted inserted replaced
471:4d0b703a094c 472:6a92cd7322cc
156 156
157 157
158 void serv_send_im(char *name, char *message, int away) 158 void serv_send_im(char *name, char *message, int away)
159 { 159 {
160 if (!USE_OSCAR) { 160 if (!USE_OSCAR) {
161 char buf[MSG_LEN - 7]; 161 char buf[MSG_LEN - 7];
162 162
163 g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name), 163 g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name),
164 message, ((away) ? " auto" : "")); 164 message, ((away) ? " auto" : ""));
165 sflap_send(buf, strlen(buf), TYPE_DATA); 165 sflap_send(buf, strlen(buf), TYPE_DATA);
166 } else { 166 } else {
167 if (away) 167 if (away)
168 aim_send_im(gaim_sess, gaim_conn, name, AIM_IMFLAGS_AWAY, message); 168 aim_send_im(gaim_sess, gaim_conn, name, AIM_IMFLAGS_AWAY, message);
169 else 169 else
170 aim_send_im(gaim_sess, gaim_conn, name, 0, message); 170 aim_send_im(gaim_sess, gaim_conn, name, 0, message);
171 } 171 }
172 if (!away) 172 if (!away)
173 serv_touch_idle(); 173 serv_touch_idle();
174 } 174 }
175 175
518 char buf[BUF_LONG]; 518 char buf[BUF_LONG];
519 g_snprintf(buf, sizeof(buf)/2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name)); 519 g_snprintf(buf, sizeof(buf)/2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name));
520 sflap_send(buf, -1, TYPE_DATA); 520 sflap_send(buf, -1, TYPE_DATA);
521 } else { 521 } else {
522 GList *bcs = buddy_chats; 522 GList *bcs = buddy_chats;
523 struct buddy_chat *b = NULL; 523 struct conversation *b = NULL;
524 524
525 while (bcs) { 525 while (bcs) {
526 b = (struct buddy_chat *)bcs->data; 526 b = (struct conversation *)bcs->data;
527 if (id == b->id) 527 if (id == b->id)
528 break; 528 break;
529 bcs = bcs->next; 529 bcs = bcs->next;
530 b = NULL; 530 b = NULL;
531 } 531 }
544 g_snprintf(buf, 255, "toc_chat_leave %d", id); 544 g_snprintf(buf, 255, "toc_chat_leave %d", id);
545 sflap_send(buf, -1, TYPE_DATA); 545 sflap_send(buf, -1, TYPE_DATA);
546 g_free(buf); 546 g_free(buf);
547 } else { 547 } else {
548 GList *bcs = buddy_chats; 548 GList *bcs = buddy_chats;
549 struct buddy_chat *b = NULL; 549 struct conversation *b = NULL;
550 struct chat_connection *c = NULL; 550 struct chat_connection *c = NULL;
551 int count = 0; 551 int count = 0;
552 552
553 while (bcs) { 553 while (bcs) {
554 count++; 554 count++;
555 b = (struct buddy_chat *)bcs->data; 555 b = (struct conversation *)bcs->data;
556 if (id == b->id) 556 if (id == b->id)
557 break; 557 break;
558 bcs = bcs->next; 558 bcs = bcs->next;
559 b = NULL; 559 b = NULL;
560 } 560 }
598 g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"",id, message); 598 g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"",id, message);
599 sflap_send(buf, -1, TYPE_DATA); 599 sflap_send(buf, -1, TYPE_DATA);
600 } else { 600 } else {
601 struct aim_conn_t *cn; 601 struct aim_conn_t *cn;
602 GList *bcs = buddy_chats; 602 GList *bcs = buddy_chats;
603 struct buddy_chat *b = NULL; 603 struct conversation *b = NULL;
604 604
605 while (bcs) { 605 while (bcs) {
606 b = (struct buddy_chat *)bcs->data; 606 b = (struct conversation *)bcs->data;
607 if (id == b->id) 607 if (id == b->id)
608 break; 608 break;
609 bcs = bcs->next; 609 bcs = bcs->next;
610 b = NULL; 610 b = NULL;
611 } 611 }
613 return; 613 return;
614 614
615 cn = aim_chat_getconn(gaim_sess, b->name); 615 cn = aim_chat_getconn(gaim_sess, b->name);
616 aim_chat_send_im(gaim_sess, cn, message); 616 aim_chat_send_im(gaim_sess, cn, message);
617 } 617 }
618 serv_touch_idle();
618 } 619 }
619 620
620 621
621 622
622 623
680 } 681 }
681 } 682 }
682 if (cnv != NULL) { 683 if (cnv != NULL) {
683 if (sound_options & OPT_SOUND_WHEN_AWAY) 684 if (sound_options & OPT_SOUND_WHEN_AWAY)
684 play_sound(AWAY); 685 play_sound(AWAY);
685 write_to_conv(cnv, message, away | WFLAG_RECV); 686 write_to_conv(cnv, message, away | WFLAG_RECV, NULL);
686 } 687 }
687 688
688 } else { 689 } else {
689 if (cnv == NULL) { 690 if (cnv == NULL) {
690 new_conv = 1; 691 new_conv = 1;
694 play_sound(FIRST_RECEIVE); 695 play_sound(FIRST_RECEIVE);
695 } else { 696 } else {
696 if (cnv->makesound && (sound_options & OPT_SOUND_RECV)) 697 if (cnv->makesound && (sound_options & OPT_SOUND_RECV))
697 play_sound(RECEIVE); 698 play_sound(RECEIVE);
698 } 699 }
699 write_to_conv(cnv, message, away | WFLAG_RECV); 700 write_to_conv(cnv, message, away | WFLAG_RECV, NULL);
700 } 701 }
701 702
702 703
703 704
704 705
724 725
725 if (is_idle == -1) 726 if (is_idle == -1)
726 is_idle = 1; 727 is_idle = 1;
727 728
728 if (cnv != NULL) 729 if (cnv != NULL)
729 write_to_conv(cnv, awaymessage->message, WFLAG_SEND | WFLAG_AUTO); 730 write_to_conv(cnv, awaymessage->message, WFLAG_SEND | WFLAG_AUTO, NULL);
730 } 731 }
731 } 732 }
732 733
733 734
734 735
961 gtk_widget_show(d); 962 gtk_widget_show(d);
962 } 963 }
963 964
964 void serv_got_joined_chat(int id, char *name) 965 void serv_got_joined_chat(int id, char *name)
965 { 966 {
966 struct buddy_chat *b; 967 struct conversation *b;
967 968
968 #ifdef GAIM_PLUGINS 969 #ifdef GAIM_PLUGINS
969 GList *c = callbacks; 970 GList *c = callbacks;
970 struct gaim_callback *g; 971 struct gaim_callback *g;
971 void (*function)(char *, void *); 972 void (*function)(char *, void *);
977 } 978 }
978 c = c->next; 979 c = c->next;
979 } 980 }
980 #endif 981 #endif
981 982
982 b = (struct buddy_chat *)g_new0(struct buddy_chat, 1); 983 b = (struct conversation *)g_new0(struct conversation, 1);
983 buddy_chats = g_list_append(buddy_chats, b); 984 buddy_chats = g_list_append(buddy_chats, b);
984 985
986 b->is_chat = TRUE;
985 b->ignored = NULL; 987 b->ignored = NULL;
986 b->in_room = NULL; 988 b->in_room = NULL;
987 b->id = id; 989 b->id = id;
988 g_snprintf(b->name, 80, "%s", name); 990 g_snprintf(b->name, 80, "%s", name);
989 show_new_buddy_chat(b); 991 show_new_buddy_chat(b);
990 } 992 }
991 993
992 void serv_got_chat_left(int id) 994 void serv_got_chat_left(int id)
993 { 995 {
994 GList *bcs = buddy_chats; 996 GList *bcs = buddy_chats;
995 struct buddy_chat *b = NULL; 997 struct conversation *b = NULL;
996 998
997 999
998 while(bcs) { 1000 while(bcs) {
999 b = (struct buddy_chat *)bcs->data; 1001 b = (struct conversation *)bcs->data;
1000 if (id == b->id) { 1002 if (id == b->id) {
1001 break; 1003 break;
1002 } 1004 }
1003 b = NULL; 1005 b = NULL;
1004 bcs = bcs->next; 1006 bcs = bcs->next;
1033 1035
1034 void serv_got_chat_in(int id, char *who, int whisper, char *message) 1036 void serv_got_chat_in(int id, char *who, int whisper, char *message)
1035 { 1037 {
1036 int w; 1038 int w;
1037 GList *bcs = buddy_chats; 1039 GList *bcs = buddy_chats;
1038 struct buddy_chat *b = NULL; 1040 struct conversation *b = NULL;
1039 1041
1040 while(bcs) { 1042 while(bcs) {
1041 b = (struct buddy_chat *)bcs->data; 1043 b = (struct conversation *)bcs->data;
1042 if (id == b->id) 1044 if (id == b->id)
1043 break; 1045 break;
1044 bcs = bcs->next; 1046 bcs = bcs->next;
1045 b = NULL; 1047 b = NULL;
1046 1048