FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

identd: Fix unknown command when service fails to start · programcoder/hexchat@5ca87b3 · GitHub

Commit 5ca87b3

Browse files
committed
identd: Fix unknown command when service fails to start
1 parent 62df565 commit 5ca87b3

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

‎src/common/plugin-identd.c‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ identd_command_cb (char *word[], char *word_eol[], void *userdata)
4949
{
5050
g_return_val_if_fail (responses != NULL, HEXCHAT_EAT_ALL);
5151

52+
if (service == NULL) /* If we are not running plugins can handle it */
53+
return HEXCHAT_EAT_HEXCHAT;
54+
5255
if (word[2] && *word[2] && word[3] && *word[3])
5356
{
5457
guint64 port = g_ascii_strtoull (word[2], NULL, 0);
@@ -65,7 +68,7 @@ identd_command_cb (char *word[], char *word_eol[], void *userdata)
6568
hexchat_command (ph, "HELP IDENTD");
6669
}
6770

68-
return HEXCHAT_EAT_HEXCHAT;
71+
return HEXCHAT_EAT_ALL;
6972
}
7073

7174
static void
@@ -150,7 +153,7 @@ identd_incoming_cb (GSocketService *service, GSocketConnection *conn,
150153
return TRUE;
151154
}
152155

153-
static gboolean
156+
static void
154157
identd_start_server (void)
155158
{
156159
GError *error = NULL;
@@ -159,7 +162,7 @@ identd_start_server (void)
159162
if (hexchat_get_prefs (ph, "identd", NULL, &enabled) == 3)
160163
{
161164
if (!enabled)
162-
return TRUE; /* Count as loaded successfully but don't start service */
165+
return;
163166
}
164167
if (hexchat_get_prefs (ph, "identd_port", NULL, &port) == 2 && (port <= 0 || port > G_MAXUINT16))
165168
{
@@ -174,14 +177,13 @@ identd_start_server (void)
174177
hexchat_printf (ph, _("*\tError starting identd server: %s"), error->message);
175178

176179
g_object_unref (service);
177-
return FALSE;
180+
service = NULL;
181+
return;
178182
}
179183
/*hexchat_printf (ph, "*\tIdentd listening on port: %d", port); */
180184

181185
g_signal_connect (G_OBJECT (service), "incoming", G_CALLBACK(identd_incoming_cb), NULL);
182186
g_socket_service_start (service);
183-
184-
return TRUE;
185187
}
186188

187189
int
@@ -198,7 +200,9 @@ identd_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name,
198200
hexchat_hook_command (ph, "IDENTD", HEXCHAT_PRI_NORM, identd_command_cb,
199201
_("IDENTD <port> <username>"), NULL);
200202

201-
return identd_start_server ();
203+
identd_start_server ();
204+
205+
return 1; /* This must always succeed for /identd to work */
202206
}
203207

204208
int

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL