comparison src/conversation.c @ 6621:42fdf16f1dad

[gaim-migrate @ 7145] Individual accounts remember the "No Proxy" setting instead of reverting back to "Use Global Proxy Settings" Proxy settings for individual accounts do not revert to "No Proxy" if you open an account, don't change the proxy drop down, then save the account. Those two sound like the same thing, but they're different. I think. Added the "use environmental variables" setting in a way that isn't horrible. We're not using that thing that splits the proxy variable into host:port yet. I'll do that later. I would have done that earlier, but I had to go buy a bike. Also, I'd like to show what the environmental variables are set to somewhere. That'll come later. Also a patch from Robot101: (22:10:25) Bzubhipheron: I have a patch that replaces #define WFLAG_* with GaimMessageFlags GAIM_MESSAGE_* (22:10:30) Bzubhipheron: (an enum in disguise) (22:14:18) Bzubhipheron: GaimMessageFlags protrays much better typing information than "int". most of the other #defines are gone, and glib standardises on enums for its flags too. (22:14:27) Bzubhipheron: (gone or going) (22:14:45) Bzubhipheron: and it makes the prototype of my message queueing stuff prettier. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 25 Aug 2003 02:49:42 +0000
parents d8fd7c29eaf0
children a4622f1fb5a1
comparison
equal deleted inserted replaced
6620:7230e5920911 6621:42fdf16f1dad
372 g_slist_free(conv->u.im->images); 372 g_slist_free(conv->u.im->images);
373 conv->u.im->images = NULL; 373 conv->u.im->images = NULL;
374 374
375 if (binary) 375 if (binary)
376 gaim_im_write(im, NULL, bigbuf, length, 376 gaim_im_write(im, NULL, bigbuf, length,
377 WFLAG_SEND, time(NULL)); 377 GAIM_MESSAGE_SEND, time(NULL));
378 else 378 else
379 gaim_im_write(im, NULL, buffy, -1, WFLAG_SEND, 379 gaim_im_write(im, NULL, buffy, -1, GAIM_MESSAGE_SEND,
380 time(NULL)); 380 time(NULL));
381 } 381 }
382 382
383 if (binary) 383 if (binary)
384 g_free(bigbuf); 384 g_free(bigbuf);
386 else { 386 else {
387 err = serv_send_im(gc, gaim_conversation_get_name(conv), 387 err = serv_send_im(gc, gaim_conversation_get_name(conv),
388 buffy, -1, imflags); 388 buffy, -1, imflags);
389 389
390 if (err > 0) 390 if (err > 0)
391 gaim_im_write(im, NULL, buf, -1, WFLAG_SEND, time(NULL)); 391 gaim_im_write(im, NULL, buf, -1, GAIM_MESSAGE_SEND, time(NULL));
392 } 392 }
393 393
394 gaim_signal_emit(gaim_conversations_get_handle(), "sent-im-msg", 394 gaim_signal_emit(gaim_conversations_get_handle(), "sent-im-msg",
395 gaim_conversation_get_account(conv), 395 gaim_conversation_get_account(conv),
396 gaim_conversation_get_name(conv), buffy); 396 gaim_conversation_get_name(conv), buffy);
1428 return c; 1428 return c;
1429 } 1429 }
1430 1430
1431 void 1431 void
1432 gaim_conversation_write(GaimConversation *conv, const char *who, 1432 gaim_conversation_write(GaimConversation *conv, const char *who,
1433 const char *message, size_t length, int flags, 1433 const char *message, size_t length, GaimMessageFlags flags,
1434 time_t mtime) 1434 time_t mtime)
1435 { 1435 {
1436 GaimPluginProtocolInfo *prpl_info = NULL; 1436 GaimPluginProtocolInfo *prpl_info = NULL;
1437 GaimConnection *gc = NULL; 1437 GaimConnection *gc = NULL;
1438 GaimAccount *account; 1438 GaimAccount *account;
1468 1468
1469 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM || 1469 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM ||
1470 !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { 1470 !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
1471 1471
1472 if (who == NULL) { 1472 if (who == NULL) {
1473 if (flags & WFLAG_SEND) { 1473 if (flags & GAIM_MESSAGE_SEND) {
1474 b = gaim_find_buddy(account, 1474 b = gaim_find_buddy(account,
1475 gaim_account_get_username(account)); 1475 gaim_account_get_username(account));
1476 1476
1477 if (b != NULL && strcmp(b->name, gaim_get_buddy_alias(b))) 1477 if (b != NULL && strcmp(b->name, gaim_get_buddy_alias(b)))
1478 who = gaim_get_buddy_alias(b); 1478 who = gaim_get_buddy_alias(b);
1505 ops->write_conv(conv, who, message, length, flags, mtime); 1505 ops->write_conv(conv, who, message, length, flags, mtime);
1506 1506
1507 win = gaim_conversation_get_window(conv); 1507 win = gaim_conversation_get_window(conv);
1508 1508
1509 /* Tab highlighting */ 1509 /* Tab highlighting */
1510 if (!(flags & WFLAG_RECV) && !(flags & WFLAG_SYSTEM)) 1510 if (!(flags & GAIM_MESSAGE_RECV) && !(flags & GAIM_MESSAGE_SYSTEM))
1511 return; 1511 return;
1512 1512
1513 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { 1513 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
1514 if ((flags & WFLAG_RECV) == WFLAG_RECV) 1514 if ((flags & GAIM_MESSAGE_RECV) == GAIM_MESSAGE_RECV)
1515 gaim_im_set_typing_state(GAIM_IM(conv), GAIM_NOT_TYPING); 1515 gaim_im_set_typing_state(GAIM_IM(conv), GAIM_NOT_TYPING);
1516 } 1516 }
1517 1517
1518 if (gaim_window_get_active_conversation(win) != conv) { 1518 if (gaim_window_get_active_conversation(win) != conv) {
1519 if ((flags & WFLAG_NICK) == WFLAG_NICK || 1519 if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK ||
1520 gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK) 1520 gaim_conversation_get_unseen(conv) == GAIM_UNSEEN_NICK)
1521 unseen = GAIM_UNSEEN_NICK; 1521 unseen = GAIM_UNSEEN_NICK;
1522 else if ((flags & WFLAG_SYSTEM) == WFLAG_SYSTEM && 1522 else if ((flags & GAIM_MESSAGE_SYSTEM) == GAIM_MESSAGE_SYSTEM &&
1523 gaim_conversation_get_unseen(conv) != GAIM_UNSEEN_TEXT) 1523 gaim_conversation_get_unseen(conv) != GAIM_UNSEEN_TEXT)
1524 unseen = GAIM_UNSEEN_EVENT; 1524 unseen = GAIM_UNSEEN_EVENT;
1525 else 1525 else
1526 unseen = GAIM_UNSEEN_TEXT; 1526 unseen = GAIM_UNSEEN_TEXT;
1527 } 1527 }
1681 GAIM_CONV_UPDATE_TYPING); 1681 GAIM_CONV_UPDATE_TYPING);
1682 } 1682 }
1683 1683
1684 void 1684 void
1685 gaim_im_write(GaimIm *im, const char *who, const char *message, 1685 gaim_im_write(GaimIm *im, const char *who, const char *message,
1686 size_t len, int flags, time_t mtime) 1686 size_t len, GaimMessageFlags flags, time_t mtime)
1687 { 1687 {
1688 GaimConversation *c; 1688 GaimConversation *c;
1689 1689
1690 g_return_if_fail(im != NULL); 1690 g_return_if_fail(im != NULL);
1691 g_return_if_fail(message != NULL); 1691 g_return_if_fail(message != NULL);
1870 return chat->id; 1870 return chat->id;
1871 } 1871 }
1872 1872
1873 void 1873 void
1874 gaim_chat_write(GaimChat *chat, const char *who, const char *message, 1874 gaim_chat_write(GaimChat *chat, const char *who, const char *message,
1875 int flags, time_t mtime) 1875 GaimMessageFlags flags, time_t mtime)
1876 { 1876 {
1877 GaimAccount *account; 1877 GaimAccount *account;
1878 GaimConversation *conv; 1878 GaimConversation *conv;
1879 GaimConnection *gc; 1879 GaimConnection *gc;
1880 1880
1888 1888
1889 /* Don't display this if the person who wrote it is ignored. */ 1889 /* Don't display this if the person who wrote it is ignored. */
1890 if (gaim_chat_is_user_ignored(chat, who)) 1890 if (gaim_chat_is_user_ignored(chat, who))
1891 return; 1891 return;
1892 1892
1893 if (!(flags & WFLAG_WHISPER)) { 1893 if (!(flags & GAIM_MESSAGE_WHISPER)) {
1894 char *str; 1894 char *str;
1895 const char *disp; 1895 const char *disp;
1896 1896
1897 str = g_strdup(normalize(who)); 1897 str = g_strdup(normalize(who));
1898 disp = gaim_connection_get_display_name(gc); 1898 disp = gaim_connection_get_display_name(gc);
1899 1899
1900 if (!gaim_utf8_strcasecmp(str, normalize(gaim_account_get_username(account))) || 1900 if (!gaim_utf8_strcasecmp(str, normalize(gaim_account_get_username(account))) ||
1901 (disp && !gaim_utf8_strcasecmp(str, normalize(disp)))) { 1901 (disp && !gaim_utf8_strcasecmp(str, normalize(disp)))) {
1902 1902
1903 flags |= WFLAG_SEND; 1903 flags |= GAIM_MESSAGE_SEND;
1904 } 1904 }
1905 else { 1905 else {
1906 flags |= WFLAG_RECV; 1906 flags |= GAIM_MESSAGE_RECV;
1907 1907
1908 if (find_nick(gc, message)) 1908 if (find_nick(gc, message))
1909 flags |= WFLAG_NICK; 1909 flags |= GAIM_MESSAGE_NICK;
1910 } 1910 }
1911 1911
1912 g_free(str); 1912 g_free(str);
1913 } 1913 }
1914 1914
1957 else 1957 else
1958 g_snprintf(tmp, sizeof(tmp), 1958 g_snprintf(tmp, sizeof(tmp),
1959 _("%s [<I>%s</I>] entered the room."), 1959 _("%s [<I>%s</I>] entered the room."),
1960 user, extra_msg); 1960 user, extra_msg);
1961 1961
1962 gaim_conversation_write(conv, NULL, tmp, -1, WFLAG_SYSTEM, time(NULL)); 1962 gaim_conversation_write(conv, NULL, tmp, -1, GAIM_MESSAGE_SYSTEM, time(NULL));
1963 } 1963 }
1964 1964
1965 gaim_signal_emit(gaim_conversations_get_handle(), 1965 gaim_signal_emit(gaim_conversations_get_handle(),
1966 "chat-buddy-joined", conv, user); 1966 "chat-buddy-joined", conv, user);
1967 } 1967 }
2041 2041
2042 if (gaim_prefs_get_bool("/core/conversations/chat/show_nick_change")) { 2042 if (gaim_prefs_get_bool("/core/conversations/chat/show_nick_change")) {
2043 g_snprintf(tmp, sizeof(tmp), 2043 g_snprintf(tmp, sizeof(tmp),
2044 _("%s is now known as %s"), old_user, new_user); 2044 _("%s is now known as %s"), old_user, new_user);
2045 2045
2046 gaim_conversation_write(conv, NULL, tmp, -1, WFLAG_SYSTEM, time(NULL)); 2046 gaim_conversation_write(conv, NULL, tmp, -1, GAIM_MESSAGE_SYSTEM, time(NULL));
2047 } 2047 }
2048 } 2048 }
2049 2049
2050 void 2050 void
2051 gaim_chat_remove_user(GaimChat *chat, const char *user, const char *reason) 2051 gaim_chat_remove_user(GaimChat *chat, const char *user, const char *reason)
2085 g_snprintf(tmp, sizeof(tmp), 2085 g_snprintf(tmp, sizeof(tmp),
2086 _("%s left the room (%s)."), user, reason); 2086 _("%s left the room (%s)."), user, reason);
2087 else 2087 else
2088 g_snprintf(tmp, sizeof(tmp), _("%s left the room."), user); 2088 g_snprintf(tmp, sizeof(tmp), _("%s left the room."), user);
2089 2089
2090 gaim_conversation_write(conv, NULL, tmp, -1, WFLAG_SYSTEM, time(NULL)); 2090 gaim_conversation_write(conv, NULL, tmp, -1, GAIM_MESSAGE_SYSTEM, time(NULL));
2091 } 2091 }
2092 2092
2093 gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-left", 2093 gaim_signal_emit(gaim_conversations_get_handle(), "chat-buddy-left",
2094 conv, user, reason); 2094 conv, user, reason);
2095 } 2095 }
2161 _("(+%d more)"), size - 10); 2161 _("(+%d more)"), size - 10);
2162 2162
2163 g_snprintf(tmp, sizeof(tmp), _(" left the room (%s)."), reason); 2163 g_snprintf(tmp, sizeof(tmp), _(" left the room (%s)."), reason);
2164 2164
2165 gaim_conversation_write(conv, NULL, tmp, -1, 2165 gaim_conversation_write(conv, NULL, tmp, -1,
2166 WFLAG_SYSTEM, time(NULL)); 2166 GAIM_MESSAGE_SYSTEM, time(NULL));
2167 } 2167 }
2168 } 2168 }
2169 } 2169 }
2170 2170
2171 void 2171 void