diff options
-rw-r--r-- | src/common/plugin-identd.c | 18 | ||||
-rw-r--r-- | src/fe-gtk/fe-gtk.c | 2 | ||||
-rw-r--r-- | src/fe-gtk/setup.c | 24 | ||||
-rw-r--r-- | src/fe-gtk/setup.h | 2 |
4 files changed, 40 insertions, 6 deletions
diff --git a/src/common/plugin-identd.c b/src/common/plugin-identd.c index 9501458c..acf3a093 100644 --- a/src/common/plugin-identd.c +++ b/src/common/plugin-identd.c @@ -22,6 +22,7 @@ #include "hexchat-plugin.h" #define _(x) hexchat_gettext(ph,x) +static void identd_start_server (void); static hexchat_plugin *ph; static GSocketService *service; @@ -49,6 +50,20 @@ identd_command_cb (char *word[], char *word_eol[], void *userdata) { g_return_val_if_fail (responses != NULL, HEXCHAT_EAT_ALL); + if (!g_strcmp0 (word[2], "reload")) + { + if (service) + { + g_socket_service_stop (service); + g_clear_object (&service); + } + + identd_start_server (); + + if (service) + return HEXCHAT_EAT_ALL; + } + if (service == NULL) /* If we are not running plugins can handle it */ return HEXCHAT_EAT_HEXCHAT; @@ -176,8 +191,7 @@ identd_start_server (void) { hexchat_printf (ph, _("*\tError starting identd server: %s"), error->message); - g_object_unref (service); - service = NULL; + g_clear_object (&service); return; } /*hexchat_printf (ph, "*\tIdentd listening on port: %d", port); */ diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c index 8c163eb7..b2418b42 100644 --- a/src/fe-gtk/fe-gtk.c +++ b/src/fe-gtk/fe-gtk.c @@ -852,7 +852,7 @@ fe_ctrl_gui (session *sess, fe_gui_action action, int arg) mg_detach (sess, arg); /* arg: 0=toggle 1=detach 2=attach */ break; case FE_GUI_APPLY: - setup_apply_real (TRUE, TRUE, TRUE); + setup_apply_real (TRUE, TRUE, TRUE, FALSE); } } diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index dc469591..a934b9d7 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -29,6 +29,7 @@ #include "../common/userlist.h" #include "../common/util.h" #include "../common/hexchatc.h" +#include "../common/outbound.h" #include "fe-gtk.h" #include "gtkutil.h" #include "maingui.h" @@ -657,6 +658,16 @@ static const setting network_settings[] = {ST_END, 0, 0, 0, 0, 0} }; +static const setting identd_settings[] = +{ + {ST_HEADER, N_("Identd Server"), 0, 0, 0, 0}, + {ST_TOGGLE, N_("Enabled"), P_OFFINTNL(hex_identd_server), N_("Server will respond with the networks username"), 0, 1}, + {ST_NUMBER, N_("Port:"), P_OFFINTNL(hex_identd_port), N_("You must have permissions to listen on this port. " + "If not 113 (0 defaults to this) then you must configure port-forwarding."), 0, 65535}, + + {ST_END, 0, 0, 0, 0, 0} +}; + #define setup_get_str(pr,set) (((char *)pr)+set->offset) #define setup_get_int(pr,set) *(((int *)pr)+set->offset) #define setup_get_int3(pr,off) *(((int *)pr)+off) @@ -1867,6 +1878,7 @@ static const char *const cata[] = N_("Network"), N_("Network setup"), N_("File transfers"), + N_("Identd"), NULL, NULL }; @@ -1909,6 +1921,7 @@ setup_create_pages (GtkWidget *box) setup_add_page (cata[15], book, setup_create_page (network_settings)); setup_add_page (cata[16], book, setup_create_page (filexfer_settings)); + setup_add_page (cata[17], book, setup_create_page (identd_settings)); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (book), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (book), FALSE); @@ -2070,7 +2083,7 @@ unslash (char *dir) } void -setup_apply_real (int new_pix, int do_ulist, int do_layout) +setup_apply_real (int new_pix, int do_ulist, int do_layout, int do_identd) { GSList *list; session *sess; @@ -2122,6 +2135,9 @@ setup_apply_real (int new_pix, int do_ulist, int do_layout) if (do_layout) menu_change_layout (); + + if (do_identd) + handle_command (current_sess, "IDENTD reload", FALSE); } static void @@ -2136,6 +2152,7 @@ setup_apply (struct hexchatprefs *pr) int noapply = FALSE; int do_ulist = FALSE; int do_layout = FALSE; + int do_identd = FALSE; if (strcmp (pr->hex_text_background, prefs.hex_text_background) != 0) new_pix = TRUE; @@ -2184,6 +2201,9 @@ setup_apply (struct hexchatprefs *pr) if (DIFF (hex_gui_tab_layout)) do_layout = TRUE; + if (DIFF (hex_identd_server) || DIFF (hex_identd_port)) + do_identd = TRUE; + if (color_change || (DIFF (hex_gui_ulist_color)) || (DIFF (hex_away_size_max)) || (DIFF (hex_away_track))) do_ulist = TRUE; @@ -2225,7 +2245,7 @@ setup_apply (struct hexchatprefs *pr) strcpy (prefs.hex_irc_real_name, "realname"); } - setup_apply_real (new_pix, do_ulist, do_layout); + setup_apply_real (new_pix, do_ulist, do_layout, do_identd); if (noapply) fe_message (_("Some settings were changed that require a" diff --git a/src/fe-gtk/setup.h b/src/fe-gtk/setup.h index d756b10e..b2c1a714 100644 --- a/src/fe-gtk/setup.h +++ b/src/fe-gtk/setup.h @@ -20,6 +20,6 @@ #ifndef HEXCHAT_SETUP_H #define HEXCHAT_SETUP_H -void setup_apply_real (int new_pix, int do_ulist, int do_layout); +void setup_apply_real (int new_pix, int do_ulist, int do_layout, int do_identd); #endif |