summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-11-23 23:04:52 +0100
committerSebastien Helleu <flashcode@flashtux.org>2008-11-23 23:04:52 +0100
commit2e52e54a3afa953e12e1e009b19a66202f0674a6 (patch)
tree08fa64e1c2b89498977ae33004f62c1757288910 /src/gui
parent09bed16dbd39791b43f86a1c00279c7fdb5cbb58 (diff)
downloadweechat-2e52e54a3afa953e12e1e009b19a66202f0674a6.zip
Add support for more than one proxy, with proxy selection for each IRC server (task #6859)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui-bar.c14
-rw-r--r--src/gui/gui-bar.h18
-rw-r--r--src/gui/gui-completion.c25
3 files changed, 42 insertions, 15 deletions
diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c
index a72e98f8c..ac299dc3e 100644
--- a/src/gui/gui-bar.c
+++ b/src/gui/gui-bar.c
@@ -61,7 +61,7 @@ struct t_gui_bar *last_gui_temp_bar = NULL;
/*
* gui_bar_search_option search a bar option name
* return index of option in array
- * "gui_bar_option_str", or -1 if not found
+ * "gui_bar_option_string", or -1 if not found
*/
int
@@ -92,9 +92,12 @@ gui_bar_search_type (const char *type)
{
int i;
+ if (!type)
+ return -1;
+
for (i = 0; i < GUI_BAR_NUM_TYPES; i++)
{
- if (string_strcasecmp (type, gui_bar_type_string[i]) == 0)
+ if (string_strcasecmp (gui_bar_type_string[i], type) == 0)
return i;
}
@@ -112,9 +115,12 @@ gui_bar_search_position (const char *position)
{
int i;
+ if (!position)
+ return -1;
+
for (i = 0; i < GUI_BAR_NUM_POSITIONS; i++)
{
- if (string_strcasecmp (position, gui_bar_position_string[i]) == 0)
+ if (string_strcasecmp (gui_bar_position_string[i], position) == 0)
return i;
}
@@ -877,7 +883,7 @@ gui_bar_set_size_max (struct t_gui_bar *bar, const char *size)
}
/*
- * gui_bar_set: set a property for bar
+ * gui_bar_set: set a property for a bar
* return: 1 if ok, 0 if error
*/
diff --git a/src/gui/gui-bar.h b/src/gui/gui-bar.h
index aaf62a1c4..7338afc85 100644
--- a/src/gui/gui-bar.h
+++ b/src/gui/gui-bar.h
@@ -45,7 +45,7 @@ enum t_gui_bar_option
GUI_BAR_OPTION_COLOR_BG,
GUI_BAR_OPTION_SEPARATOR,
GUI_BAR_OPTION_ITEMS,
- /* number of bar types */
+ /* number of bar options */
GUI_BAR_NUM_OPTIONS,
};
@@ -98,15 +98,15 @@ struct t_gui_bar
struct t_config_option *items; /* bar items */
/* internal vars */
- int conditions_count; /* number of conditions */
- char **conditions_array; /* exploded bar conditions */
- int items_count; /* number of bar items */
- char **items_array; /* exploded bar items */
+ int conditions_count; /* number of conditions */
+ char **conditions_array; /* exploded bar conditions */
+ int items_count; /* number of bar items */
+ char **items_array; /* exploded bar items */
struct t_gui_bar_window *bar_window; /* pointer to bar window */
- /* (for type root only) */
- int bar_refresh_needed; /* refresh for bar is needed? */
- struct t_gui_bar *prev_bar; /* link to previous bar */
- struct t_gui_bar *next_bar; /* link to next bar */
+ /* (for type root only) */
+ int bar_refresh_needed; /* refresh for bar is needed? */
+ struct t_gui_bar *prev_bar; /* link to previous bar */
+ struct t_gui_bar *next_bar; /* link to next bar */
};
/* variables */
diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c
index e53fd81af..fd09dd4ef 100644
--- a/src/gui/gui-completion.c
+++ b/src/gui/gui-completion.c
@@ -33,10 +33,11 @@
#include "../core/weechat.h"
#include "../core/wee-config.h"
#include "../core/wee-hook.h"
+#include "../core/wee-list.h"
#include "../core/wee-log.h"
+#include "../core/wee-proxy.h"
#include "../core/wee-string.h"
#include "../core/wee-utf8.h"
-#include "../core/wee-list.h"
#include "../plugins/plugin.h"
#include "../plugins/plugin-config.h"
#include "gui-completion.h"
@@ -321,7 +322,7 @@ gui_completion_list_add (struct t_gui_completion *completion, const char *word,
}
/*
- * gui_completion_list_add_bars_names: add buffers names to completion list
+ * gui_completion_list_add_bars_names: add bars names to completion list
*/
void
@@ -883,6 +884,23 @@ gui_completion_list_add_weechat_cmd (struct t_gui_completion *completion)
}
/*
+ * gui_completion_list_add_proxies_names: add proxies names to completion list
+ */
+
+void
+gui_completion_list_add_proxies_names (struct t_gui_completion *completion)
+{
+ struct t_proxy *ptr_proxy;
+
+ for (ptr_proxy = weechat_proxies; ptr_proxy;
+ ptr_proxy = ptr_proxy->next_proxy)
+ {
+ gui_completion_list_add (completion, ptr_proxy->name,
+ 0, WEECHAT_LIST_POS_SORT);
+ }
+}
+
+/*
* gui_completion_custom: custom completion by a plugin
*/
@@ -983,6 +1001,9 @@ gui_completion_build_list_template (struct t_gui_completion *completion,
case 'w': /* WeeChat commands */
gui_completion_list_add_weechat_cmd (completion);
break;
+ case 'y': /* proxy names */
+ gui_completion_list_add_proxies_names (completion);
+ break;
case '(': /* custom completion by a plugin */
pos++;
pos_end = strchr (pos, ')');