# HG changeset patch # User Elliott Sales de Andrade # Date 1212825836 0 # Node ID 2338f36b41adb3ffc38ec43dfd26f89adcc27fd9 # Parent 70de4e2246ecc7a896e05013c1adeaa1af8f3d31# Parent ea341703b1d3148d401b7f6b0643df9f1a6df9cd propagate from branch 'im.pidgin.pidgin' (head 23913fa16455106d8848482b13e9a49b823e6051) to branch 'im.pidgin.cpw.qulogic.msn' (head 08c7dad6f6504b8f75816081fcd284f1608eb358) diff -r 70de4e2246ec -r 2338f36b41ad ChangeLog --- a/ChangeLog Sat Jun 07 08:01:41 2008 +0000 +++ b/ChangeLog Sat Jun 07 08:03:56 2008 +0000 @@ -22,6 +22,8 @@ * Added "Invite..." menu to chats. * Added "View All Logs" menu in the buddylist to display a list of all IM logs. + * Added '/msgcolor' command to change colors of different classes of + messages in a conversation. See '/help msgcolor' for details. version 2.4.2 (05/17/2008): libpurple: diff -r 70de4e2246ec -r 2338f36b41ad finch/gntconv.c --- a/finch/gntconv.c Sat Jun 07 08:01:41 2008 +0000 +++ b/finch/gntconv.c Sat Jun 07 08:03:56 2008 +0000 @@ -1241,6 +1241,47 @@ } static PurpleCmdRet +cmd_message_color(PurpleConversation *conv, const char *cmd, char **args, char **error, gpointer data) +{ + int *msgclass = NULL; + int fg, bg; + + if (strcmp(args[0], "receive") == 0) + msgclass = &color_message_receive; + else if (strcmp(args[0], "send") == 0) + msgclass = &color_message_send; + else if (strcmp(args[0], "highlight") == 0) + msgclass = &color_message_highlight; + else if (strcmp(args[0], "action") == 0) + msgclass = &color_message_action; + else if (strcmp(args[0], "timestamp") == 0) + msgclass = &color_timestamp; + else { + if (error) + *error = g_strdup_printf(_("%s is not a valid message class. See '/help msgcolor' for valid message classes."), args[0]); + return PURPLE_CMD_STATUS_FAILED; + } + + fg = gnt_colors_get_color(args[1]); + if (fg == -EINVAL) { + if (error) + *error = g_strdup_printf(_("%s is not a valid color. See '/help msgcolor' for valid colors."), args[1]); + return PURPLE_CMD_STATUS_FAILED; + } + + bg = gnt_colors_get_color(args[2]); + if (bg == -EINVAL) { + if (error) + *error = g_strdup_printf(_("%s is not a valid color. See '/help msgcolor' for valid colors."), args[2]); + return PURPLE_CMD_STATUS_FAILED; + } + + init_pair(*msgclass, fg, bg); + + return PURPLE_CMD_STATUS_OK; +} + +static PurpleCmdRet users_command_cb(PurpleConversation *conv, const char *cmd, char **args, char **error, gpointer data) { FinchConv *fc = FINCH_GET_DATA(conv); @@ -1324,6 +1365,16 @@ PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, cmd_show_window, _("statuses: Show the savedstatuses window."), finch_savedstatus_show_all); + /* Allow customizing the message colors using a command during run-time */ + purple_cmd_register("msgcolor", "www", PURPLE_CMD_P_DEFAULT, + PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, + cmd_message_color, _("msgcolor <class> <foreground> <background>: " + "Set the color for different classes of messages in the conversation window.
" + " <class>: receive, send, highlight, action, timestamp
" + " <foreground/background>: black, red, green, blue, white, gray, darkgray, magenta, cyan, default

" + "EXAMPLE:
msgcolor send cyan default"), + NULL); + purple_signal_connect(purple_conversations_get_handle(), "buddy-typing", finch_conv_get_handle(), PURPLE_CALLBACK(update_buddy_typing), NULL); purple_signal_connect(purple_conversations_get_handle(), "buddy-typing-stopped", finch_conv_get_handle(), diff -r 70de4e2246ec -r 2338f36b41ad finch/libgnt/gntcolors.c --- a/finch/libgnt/gntcolors.c Sat Jun 07 08:01:41 2008 +0000 +++ b/finch/libgnt/gntcolors.c Sat Jun 07 08:03:56 2008 +0000 @@ -29,6 +29,7 @@ #include +#include #include #include @@ -168,7 +169,7 @@ color = -1; else { g_warning("Invalid color name: %s\n", key); - color = -1; + color = -EINVAL; } return color; } diff -r 70de4e2246ec -r 2338f36b41ad finch/libgnt/gntcolors.h --- a/finch/libgnt/gntcolors.h Sat Jun 07 08:01:41 2008 +0000 +++ b/finch/libgnt/gntcolors.h Sat Jun 07 08:03:56 2008 +0000 @@ -91,7 +91,7 @@ * * @param kfile The string value * - * @return A color + * @return A color. For an unknown color name, returns -EINVAL. * * @since 2.4.0 */ diff -r 70de4e2246ec -r 2338f36b41ad libpurple/certificate.c --- a/libpurple/certificate.c Sat Jun 07 08:01:41 2008 +0000 +++ b/libpurple/certificate.c Sat Jun 07 08:03:56 2008 +0000 @@ -787,8 +787,7 @@ for (cur = lst; cur; cur = cur->next) { x509_ca_element *el = cur->data; - /* TODO: Unsafe? */ - if ( !strcmp(dn, el->dn) ) { + if (el->dn && !strcmp(dn, el->dn)) { return el; } }