diff options
Diffstat (limited to 'src/ivy-xchat-plugin.c')
-rw-r--r-- | src/ivy-xchat-plugin.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/ivy-xchat-plugin.c b/src/ivy-xchat-plugin.c index ba67c5d..da27fdf 100644 --- a/src/ivy-xchat-plugin.c +++ b/src/ivy-xchat-plugin.c @@ -25,6 +25,7 @@ #include "plugin.h" #include "text.h" #include "inbound.h" +#include "cfgfiles.h" extern struct module *module_find (char *name); extern void module_add_cmds (struct module_cmd_set *xc_cmds); @@ -178,6 +179,11 @@ cmd_bind (struct session *sess, char *tbuf, char *word[], char *word_eol[]) int module_init (int ver, struct module *mod, struct session *sess) { + FILE* conf; + char optionfile[256]; + char* bus = 0; + char busbuf[512]; + /** first let's do our connection work as an xchat plugin **/ /* version check */ @@ -210,9 +216,18 @@ module_init (int ver, struct module *mod, struct session *sess) hook_signal (&chanmsg_sig); /** then let's connect to Ivy **/ + + /* read bus configuration file */ + snprintf (optionfile, sizeof (optionfile), "%s/ivy.conf", get_xdir ()); + conf = fopen (optionfile, "r"); + if (conf) { + if (fscanf (conf, "bus = %512s", busbuf) == 1) + bus = busbuf; + } + IvyGtkChannelInit (); IvyInit ("ivy-xchat-plugin", 0, 0, 0, 0, 0); - IvyStart (0); + IvyStart (bus); return 0; } |