Mercurial > pidgin.yaz
comparison src/protocols/irc/msgs.c @ 11338:17142948653e
[gaim-migrate @ 13551]
Change the GAIM_CONV_IM and GAIM_CONV_CHAT enums to GAIM_CONV_TYPE_IM
and GAIM_CONV_TYPE_CHAT. This touched A LOT of files. Also combined
two oscar header files (one of them was small and dorky).
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 25 Aug 2005 02:33:44 +0000 |
parents | a659e6bac294 |
children | 4eaa0f7eb3c9 |
comparison
equal
deleted
inserted
replaced
11337:1462b64f8fc9 | 11338:17142948653e |
---|---|
124 char *buf, *nick; | 124 char *buf, *nick; |
125 | 125 |
126 if (!args || !args[0] || !args[1] || !args[2]) | 126 if (!args || !args[0] || !args[1] || !args[2]) |
127 return; | 127 return; |
128 | 128 |
129 convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[1], irc->account); | 129 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[1], irc->account); |
130 if (!convo) | 130 if (!convo) |
131 return; | 131 return; |
132 | 132 |
133 nick = g_markup_escape_text(args[2], -1); | 133 nick = g_markup_escape_text(args[2], -1); |
134 buf = g_strdup_printf(_("Cannot ban %s: banlist is full"), nick); | 134 buf = g_strdup_printf(_("Cannot ban %s: banlist is full"), nick); |
145 char *buf, *escaped; | 145 char *buf, *escaped; |
146 | 146 |
147 if (!args || !args[1] || !args[2]) | 147 if (!args || !args[1] || !args[2]) |
148 return; | 148 return; |
149 | 149 |
150 convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[1], irc->account); | 150 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[1], irc->account); |
151 if (!convo) /* XXX punt on channels we are not in for now */ | 151 if (!convo) /* XXX punt on channels we are not in for now */ |
152 return; | 152 return; |
153 | 153 |
154 escaped = (args[3] != NULL) ? g_markup_escape_text(args[3], -1) : NULL; | 154 escaped = (args[3] != NULL) ? g_markup_escape_text(args[3], -1) : NULL; |
155 buf = g_strdup_printf("mode for %s: %s %s", args[1], args[2], escaped ? escaped : ""); | 155 buf = g_strdup_printf("mode for %s: %s %s", args[1], args[2], escaped ? escaped : ""); |
303 } else { | 303 } else { |
304 chan = args[1]; | 304 chan = args[1]; |
305 topic = irc_mirc2txt (args[2]); | 305 topic = irc_mirc2txt (args[2]); |
306 } | 306 } |
307 | 307 |
308 convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, chan, irc->account); | 308 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, chan, irc->account); |
309 if (!convo) { | 309 if (!convo) { |
310 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a topic for %s, which doesn't exist\n", chan); | 310 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a topic for %s, which doesn't exist\n", chan); |
311 } | 311 } |
312 | 312 |
313 /* If this is an interactive update, print it out */ | 313 /* If this is an interactive update, print it out */ |
348 { | 348 { |
349 char *names, *cur, *end, *tmp, *msg; | 349 char *names, *cur, *end, *tmp, *msg; |
350 GaimConversation *convo; | 350 GaimConversation *convo; |
351 | 351 |
352 if (!strcmp(name, "366")) { | 352 if (!strcmp(name, "366")) { |
353 convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, irc->nameconv ? irc->nameconv : args[1], irc->account); | 353 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, irc->nameconv ? irc->nameconv : args[1], irc->account); |
354 if (!convo) { | 354 if (!convo) { |
355 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a NAMES list for %s, which doesn't exist\n", args[2]); | 355 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a NAMES list for %s, which doesn't exist\n", args[2]); |
356 g_string_free(irc->names, TRUE); | 356 g_string_free(irc->names, TRUE); |
357 irc->names = NULL; | 357 irc->names = NULL; |
358 g_free(irc->nameconv); | 358 g_free(irc->nameconv); |
362 | 362 |
363 names = cur = g_string_free(irc->names, FALSE); | 363 names = cur = g_string_free(irc->names, FALSE); |
364 irc->names = NULL; | 364 irc->names = NULL; |
365 if (irc->nameconv) { | 365 if (irc->nameconv) { |
366 msg = g_strdup_printf(_("Users on %s: %s"), args[1], names ? names : ""); | 366 msg = g_strdup_printf(_("Users on %s: %s"), args[1], names ? names : ""); |
367 if (gaim_conversation_get_type(convo) == GAIM_CONV_CHAT) | 367 if (gaim_conversation_get_type(convo) == GAIM_CONV_TYPE_CHAT) |
368 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); | 368 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
369 else | 369 else |
370 gaim_conv_im_write(GAIM_CONV_IM(convo), "", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); | 370 gaim_conv_im_write(GAIM_CONV_IM(convo), "", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
371 g_free(msg); | 371 g_free(msg); |
372 g_free(irc->nameconv); | 372 g_free(irc->nameconv); |
478 void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args) | 478 void irc_msg_nonick(struct irc_conn *irc, const char *name, const char *from, char **args) |
479 { | 479 { |
480 GaimConnection *gc; | 480 GaimConnection *gc; |
481 GaimConversation *convo; | 481 GaimConversation *convo; |
482 | 482 |
483 convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, args[1], irc->account); | 483 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, args[1], irc->account); |
484 if (convo) { | 484 if (convo) { |
485 if (gaim_conversation_get_type(convo) == GAIM_CONV_CHAT) /* does this happen? */ | 485 if (gaim_conversation_get_type(convo) == GAIM_CONV_TYPE_CHAT) /* does this happen? */ |
486 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], _("no such channel"), | 486 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], _("no such channel"), |
487 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); | 487 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
488 else | 488 else |
489 gaim_conv_im_write(GAIM_CONV_IM(convo), args[1], _("User is not logged in"), | 489 gaim_conv_im_write(GAIM_CONV_IM(convo), args[1], _("User is not logged in"), |
490 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); | 490 GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
503 void irc_msg_nosend(struct irc_conn *irc, const char *name, const char *from, char **args) | 503 void irc_msg_nosend(struct irc_conn *irc, const char *name, const char *from, char **args) |
504 { | 504 { |
505 GaimConnection *gc; | 505 GaimConnection *gc; |
506 GaimConversation *convo; | 506 GaimConversation *convo; |
507 | 507 |
508 convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[1], irc->account); | 508 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[1], irc->account); |
509 if (convo) { | 509 if (convo) { |
510 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], args[2], GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); | 510 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), args[1], args[2], GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
511 } else { | 511 } else { |
512 if ((gc = gaim_account_get_connection(irc->account)) == NULL) | 512 if ((gc = gaim_account_get_connection(irc->account)) == NULL) |
513 return; | 513 return; |
515 } | 515 } |
516 } | 516 } |
517 | 517 |
518 void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args) | 518 void irc_msg_notinchan(struct irc_conn *irc, const char *name, const char *from, char **args) |
519 { | 519 { |
520 GaimConversation *convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[1], irc->account); | 520 GaimConversation *convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[1], irc->account); |
521 | 521 |
522 gaim_debug(GAIM_DEBUG_INFO, "irc", "We're apparently not in %s, but tried to use it\n", args[1]); | 522 gaim_debug(GAIM_DEBUG_INFO, "irc", "We're apparently not in %s, but tried to use it\n", args[1]); |
523 if (convo) { | 523 if (convo) { |
524 /*g_slist_remove(irc->gc->buddy_chats, convo); | 524 /*g_slist_remove(irc->gc->buddy_chats, convo); |
525 gaim_conversation_set_account(convo, NULL);*/ | 525 gaim_conversation_set_account(convo, NULL);*/ |
532 GaimConversation *convo; | 532 GaimConversation *convo; |
533 | 533 |
534 if (!args || !args[1] || !args[2]) | 534 if (!args || !args[1] || !args[2]) |
535 return; | 535 return; |
536 | 536 |
537 convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[1], irc->account); | 537 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[1], irc->account); |
538 if (!convo) | 538 if (!convo) |
539 return; | 539 return; |
540 | 540 |
541 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", args[2], GAIM_MESSAGE_SYSTEM, time(NULL)); | 541 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "", args[2], GAIM_MESSAGE_SYSTEM, time(NULL)); |
542 } | 542 } |
630 serv_got_joined_chat(gc, id++, args[0]); | 630 serv_got_joined_chat(gc, id++, args[0]); |
631 g_free(nick); | 631 g_free(nick); |
632 return; | 632 return; |
633 } | 633 } |
634 | 634 |
635 convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); | 635 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[0], irc->account); |
636 if (convo == NULL) { | 636 if (convo == NULL) { |
637 gaim_debug(GAIM_DEBUG_ERROR, "irc", "JOIN for %s failed\n", args[0]); | 637 gaim_debug(GAIM_DEBUG_ERROR, "irc", "JOIN for %s failed\n", args[0]); |
638 g_free(nick); | 638 g_free(nick); |
639 return; | 639 return; |
640 } | 640 } |
652 } | 652 } |
653 | 653 |
654 void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args) | 654 void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args) |
655 { | 655 { |
656 GaimConnection *gc = gaim_account_get_connection(irc->account); | 656 GaimConnection *gc = gaim_account_get_connection(irc->account); |
657 GaimConversation *convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); | 657 GaimConversation *convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[0], irc->account); |
658 char *nick = irc_mask_nick(from), *buf, *reason; | 658 char *nick = irc_mask_nick(from), *buf, *reason; |
659 | 659 |
660 if (!gc) { | 660 if (!gc) { |
661 g_free(nick); | 661 g_free(nick); |
662 return; | 662 return; |
690 GaimConversation *convo; | 690 GaimConversation *convo; |
691 char *nick = irc_mask_nick(from), *buf; | 691 char *nick = irc_mask_nick(from), *buf; |
692 | 692 |
693 if (*args[0] == '#' || *args[0] == '&') { /* Channel */ | 693 if (*args[0] == '#' || *args[0] == '&') { /* Channel */ |
694 char *escaped; | 694 char *escaped; |
695 convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); | 695 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[0], irc->account); |
696 if (!convo) { | 696 if (!convo) { |
697 gaim_debug(GAIM_DEBUG_ERROR, "irc", "MODE received for %s, which we are not in\n", args[0]); | 697 gaim_debug(GAIM_DEBUG_ERROR, "irc", "MODE received for %s, which we are not in\n", args[0]); |
698 g_free(nick); | 698 g_free(nick); |
699 return; | 699 return; |
700 } | 700 } |
770 if (gaim_conv_chat_find_user(chat, nick)) | 770 if (gaim_conv_chat_find_user(chat, nick)) |
771 gaim_conv_chat_rename_user(chat, nick, args[0]); | 771 gaim_conv_chat_rename_user(chat, nick, args[0]); |
772 chats = chats->next; | 772 chats = chats->next; |
773 } | 773 } |
774 | 774 |
775 conv = gaim_find_conversation_with_account(GAIM_CONV_IM, nick, | 775 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, nick, |
776 irc->account); | 776 irc->account); |
777 if (conv != NULL) | 777 if (conv != NULL) |
778 gaim_conversation_set_name(conv, args[0]); | 778 gaim_conversation_set_name(conv, args[0]); |
779 | 779 |
780 g_free(nick); | 780 g_free(nick); |
832 char *nick, *msg, *escaped; | 832 char *nick, *msg, *escaped; |
833 | 833 |
834 if (!args || !args[0] || !gc) | 834 if (!args || !args[0] || !gc) |
835 return; | 835 return; |
836 | 836 |
837 convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); | 837 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[0], irc->account); |
838 if (!convo) { | 838 if (!convo) { |
839 gaim_debug(GAIM_DEBUG_INFO, "irc", "Got a PART on %s, which doesn't exist -- probably closed\n", args[0]); | 839 gaim_debug(GAIM_DEBUG_INFO, "irc", "Got a PART on %s, which doesn't exist -- probably closed\n", args[0]); |
840 return; | 840 return; |
841 } | 841 } |
842 | 842 |
888 msg = g_strdup(_("Error: invalid PONG from server")); | 888 msg = g_strdup(_("Error: invalid PONG from server")); |
889 } else { | 889 } else { |
890 msg = g_strdup_printf(_("PING reply -- Lag: %lu seconds"), time(NULL) - oldstamp); | 890 msg = g_strdup_printf(_("PING reply -- Lag: %lu seconds"), time(NULL) - oldstamp); |
891 } | 891 } |
892 | 892 |
893 convo = gaim_find_conversation_with_account(GAIM_CONV_ANY, parts[0], irc->account); | 893 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_ANY, parts[0], irc->account); |
894 g_strfreev(parts); | 894 g_strfreev(parts); |
895 if (convo) { | 895 if (convo) { |
896 if (gaim_conversation_get_type (convo) == GAIM_CONV_CHAT) | 896 if (gaim_conversation_get_type (convo) == GAIM_CONV_TYPE_CHAT) |
897 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "PONG", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); | 897 gaim_conv_chat_write(GAIM_CONV_CHAT(convo), "PONG", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
898 else | 898 else |
899 gaim_conv_im_write(GAIM_CONV_IM(convo), "PONG", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); | 899 gaim_conv_im_write(GAIM_CONV_IM(convo), "PONG", msg, GAIM_MESSAGE_SYSTEM|GAIM_MESSAGE_NO_LOG, time(NULL)); |
900 } else { | 900 } else { |
901 gc = gaim_account_get_connection(irc->account); | 901 gc = gaim_account_get_connection(irc->account); |
942 if (!gaim_utf8_strcasecmp(args[0], gaim_connection_get_display_name(gc))) { | 942 if (!gaim_utf8_strcasecmp(args[0], gaim_connection_get_display_name(gc))) { |
943 serv_got_im(gc, nick, msg, 0, time(NULL)); | 943 serv_got_im(gc, nick, msg, 0, time(NULL)); |
944 } else if (notice) { | 944 } else if (notice) { |
945 serv_got_im(gc, nick, msg, 0, time(NULL)); | 945 serv_got_im(gc, nick, msg, 0, time(NULL)); |
946 } else { | 946 } else { |
947 convo = gaim_find_conversation_with_account(GAIM_CONV_CHAT, args[0], irc->account); | 947 convo = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, args[0], irc->account); |
948 if (convo) | 948 if (convo) |
949 serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)), nick, 0, msg, time(NULL)); | 949 serv_got_chat_in(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(convo)), nick, 0, msg, time(NULL)); |
950 else | 950 else |
951 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a PRIVMSG on %s, which does not exist\n", args[0]); | 951 gaim_debug(GAIM_DEBUG_ERROR, "irc", "Got a PRIVMSG on %s, which does not exist\n", args[0]); |
952 } | 952 } |