diff libgaim/protocols/irc/cmds.c @ 14482:a5c7db7be826

[gaim-migrate @ 17201] Prevent irc accounts from being disconnected for long periods without us noticing. Use the prpl keepalive cb to ping the server if we haven't received anything in at least 60 seconds. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Sat, 09 Sep 2006 19:39:31 +0000
parents 60b1bc8dbf37
children
line wrap: on
line diff
--- a/libgaim/protocols/irc/cmds.c	Sat Sep 09 19:31:45 2006 +0000
+++ b/libgaim/protocols/irc/cmds.c	Sat Sep 09 19:39:31 2006 +0000
@@ -1,10 +1,10 @@
 /**
  * @file cmds.c
- * 
+ *
  * gaim
  *
  * Copyright (C) 2003, Ethan Blanton <eblanton@cs.purdue.edu>
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -336,10 +336,14 @@
 		stamp = g_strdup_printf("\001PING %lu\001", time(NULL));
 		buf = irc_format(irc, "vn:", "PRIVMSG", args[0], stamp);
 		g_free(stamp);
-	} else {
+	} else if (target) {
 		stamp = g_strdup_printf("%s %lu", target, time(NULL));
 		buf = irc_format(irc, "v:", "PING", stamp);
 		g_free(stamp);
+	} else {
+		stamp = g_strdup_printf("%lu", time(NULL));
+		buf = irc_format(irc, "vv", "PING", stamp);
+		g_free(stamp);
 	}
 	irc_send(irc, buf);
 	g_free(buf);