Mercurial > pidgin.yaz
changeset 23518:2338f36b41ad
propagate from branch 'im.pidgin.pidgin' (head 23913fa16455106d8848482b13e9a49b823e6051)
to branch 'im.pidgin.cpw.qulogic.msn' (head 08c7dad6f6504b8f75816081fcd284f1608eb358)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 07 Jun 2008 08:03:56 +0000 |
parents | 70de4e2246ec (current diff) ea341703b1d3 (diff) |
children | 9a53c441f8c1 |
files | |
diffstat | 5 files changed, 57 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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:
--- 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.<br>" + " <class>: receive, send, highlight, action, timestamp<br>" + " <foreground/background>: black, red, green, blue, white, gray, darkgray, magenta, cyan, default<br><br>" + "EXAMPLE:<br> 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(),
--- 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 <glib.h> +#include <errno.h> #include <stdlib.h> #include <string.h> @@ -168,7 +169,7 @@ color = -1; else { g_warning("Invalid color name: %s\n", key); - color = -1; + color = -EINVAL; } return color; }
--- 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 */
--- 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; } }