weechat-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Weechat-cvs] weechat/src/plugins weechat-plugin.h plugins.h ...


From: FlashCode
Subject: [Weechat-cvs] weechat/src/plugins weechat-plugin.h plugins.h ...
Date: Sat, 10 Jun 2006 18:59:43 +0000

CVSROOT:        /sources/weechat
Module name:    weechat
Changes by:     FlashCode <flashcode>   06/06/10 18:59:43

Modified files:
        src/plugins    : weechat-plugin.h plugins.h plugins.c 
                         plugins-interface.c 

Log message:
        Added plugin API function to get IRC color number by name

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/weechat/src/plugins/weechat-plugin.h?cvsroot=weechat&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/weechat/src/plugins/plugins.h?cvsroot=weechat&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/weechat/src/plugins/plugins.c?cvsroot=weechat&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/weechat/src/plugins/plugins-interface.c?cvsroot=weechat&r1=1.31&r2=1.32

Patches:
Index: weechat-plugin.h
===================================================================
RCS file: /sources/weechat/weechat/src/plugins/weechat-plugin.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- weechat-plugin.h    10 Jun 2006 18:07:57 -0000      1.22
+++ weechat-plugin.h    10 Jun 2006 18:59:43 -0000      1.23
@@ -263,6 +263,8 @@
     
     void (*input_color) (t_weechat_plugin *, int, int, int);
     
+    int (*get_irc_color) (t_weechat_plugin *, char *);
+    
     /* WeeChat developers: ALWAYS add new functions at the end */
 };
 
@@ -318,5 +320,6 @@
 extern t_plugin_nick_info *weechat_plugin_get_nick_info (t_weechat_plugin *, 
char *, char *);
 extern void weechat_plugin_free_nick_info (t_weechat_plugin *, 
t_plugin_nick_info *);
 extern void weechat_plugin_input_color (t_weechat_plugin *, int, int, int);
+extern int weechat_plugin_get_irc_color (t_weechat_plugin *, char *);
 
 #endif /* weechat-plugin.h */

Index: plugins.h
===================================================================
RCS file: /sources/weechat/weechat/src/plugins/plugins.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- plugins.h   30 Mar 2006 12:08:55 -0000      1.28
+++ plugins.h   10 Jun 2006 18:59:43 -0000      1.29
@@ -26,12 +26,22 @@
 #include "../irc/irc.h"
 #include "../gui/gui.h"
 
+typedef struct t_plugin_irc_color t_plugin_irc_color;
+
+struct t_plugin_irc_color
+{
+    int number;
+    char *name;
+};
+
 typedef int (t_weechat_init_func) (t_weechat_plugin *);
 typedef void (t_weechat_end_func) (t_weechat_plugin *);
 
 extern t_weechat_plugin *weechat_plugins;
 extern t_weechat_plugin *last_weechat_plugin;
 
+extern t_plugin_irc_color plugins_irc_colors[GUI_NUM_IRC_COLORS];
+
 extern int plugin_find_server_channel (char *, char *,
                                        t_irc_server **, t_irc_channel **);
 extern void plugin_exec_on_files (t_weechat_plugin *, char *,

Index: plugins.c
===================================================================
RCS file: /sources/weechat/weechat/src/plugins/plugins.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- plugins.c   1 Jun 2006 14:16:23 -0000       1.55
+++ plugins.c   10 Jun 2006 18:59:43 -0000      1.56
@@ -46,6 +46,24 @@
 t_weechat_plugin *weechat_plugins = NULL;
 t_weechat_plugin *last_weechat_plugin = NULL;
 
+t_plugin_irc_color plugins_irc_colors[GUI_NUM_IRC_COLORS] =
+{ { /*  0 */ WEECHAT_IRC_COLOR_WHITE,        "white"        },
+  { /*  1 */ WEECHAT_IRC_COLOR_BLACK,        "black"        },
+  { /*  2 */ WEECHAT_IRC_COLOR_BLUE,         "blue"         },
+  { /*  3 */ WEECHAT_IRC_COLOR_GREEN,        "green"        },
+  { /*  4 */ WEECHAT_IRC_COLOR_LIGHTRED,     "lightred"     },
+  { /*  5 */ WEECHAT_IRC_COLOR_RED,          "red"          },
+  { /*  6 */ WEECHAT_IRC_COLOR_MAGENTA,      "magenta"      },
+  { /*  7 */ WEECHAT_IRC_COLOR_BROWN,        "brown"        },
+  { /*  8 */ WEECHAT_IRC_COLOR_YELLOW,       "yellow"       },
+  { /*  9 */ WEECHAT_IRC_COLOR_LIGHTGREEN,   "lightgreen"   },
+  { /* 10 */ WEECHAT_IRC_COLOR_CYAN,         "cyan"         },
+  { /* 11 */ WEECHAT_IRC_COLOR_LIGHTCYAN,    "lightcyan"    },
+  { /* 12 */ WEECHAT_IRC_COLOR_LIGHTBLUE,    "lightblue"    },
+  { /* 13 */ WEECHAT_IRC_COLOR_LIGHTMAGENTA, "lightmagenta" },
+  { /* 14 */ WEECHAT_IRC_COLOR_GRAY,         "gray"         },
+  { /* 15 */ WEECHAT_IRC_COLOR_LIGHTGRAY,    "lightgray"    }};
+
 
 /*
  * plugin_find_server_channel: find server/channel for command execution
@@ -861,6 +879,7 @@
        new_plugin->get_nick_info = &weechat_plugin_get_nick_info;
        new_plugin->free_nick_info = &weechat_plugin_free_nick_info;
         new_plugin->input_color = &weechat_plugin_input_color;
+        new_plugin->get_irc_color = &weechat_plugin_get_irc_color;
         
         /* handlers */
         new_plugin->handlers = NULL;

Index: plugins-interface.c
===================================================================
RCS file: /sources/weechat/weechat/src/plugins/plugins-interface.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- plugins-interface.c 10 Jun 2006 18:07:57 -0000      1.31
+++ plugins-interface.c 10 Jun 2006 18:59:43 -0000      1.32
@@ -1090,3 +1090,25 @@
         }
     }
 }
+
+/*
+ * weechat_plugin_get_irc_color: get number of IRC color name
+ */
+
+int
+weechat_plugin_get_irc_color (t_weechat_plugin *plugin, char *color_name)
+{
+    int i;
+
+    if (!plugin)
+        return -1;
+    
+    for (i = 0; i < GUI_NUM_IRC_COLORS; i++)
+    {
+        if (strcasecmp (plugins_irc_colors[i].name, color_name) == 0)
+            return i;
+    }
+    
+    /* color not found */
+    return -1;
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]