summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fe-common/irc/fe-ctcp.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/fe-common/irc/fe-ctcp.c b/src/fe-common/irc/fe-ctcp.c
index e2b3e4ed..1c2ed843 100644
--- a/src/fe-common/irc/fe-ctcp.c
+++ b/src/fe-common/irc/fe-ctcp.c
@@ -65,7 +65,9 @@ static void ctcp_time_msg(const char *data, IRC_SERVER_REC *server, const char *
ctcp_print("CTCP TIME", data, server, nick, addr, target);
}
-static void ctcp_default_reply(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target)
+static void ctcp_default_reply(const char *data, IRC_SERVER_REC *server,
+ const char *nick, const char *addr,
+ const char *target)
{
const char *ctcpdata;
char *ctcp, *ptr;
@@ -86,15 +88,21 @@ static void ctcp_default_reply(const char *data, IRC_SERVER_REC *server, const c
g_free(ctcp);
}
-static void ctcp_ping_reply(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target)
+static void ctcp_ping_reply(const char *data, IRC_SERVER_REC *server,
+ const char *nick, const char *addr,
+ const char *target)
{
GTimeVal tv, tv2;
long usecs;
g_return_if_fail(data != NULL);
- if (sscanf(data, "%ld %ld", &tv2.tv_sec, &tv2.tv_usec) != 2)
+ if (sscanf(data, "%ld %ld", &tv2.tv_sec, &tv2.tv_usec) != 2) {
+ char *tmp = g_strconcat("PING ", data, NULL);
+ ctcp_default_reply(tmp, server, nick, addr, target);
+ g_free(tmp);
return;
+ }
g_get_current_time(&tv);
usecs = get_timeval_diff(&tv, &tv2);