comparison 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
comparison
equal deleted inserted replaced
14481:452007468387 14482:a5c7db7be826
1 /** 1 /**
2 * @file cmds.c 2 * @file cmds.c
3 * 3 *
4 * gaim 4 * gaim
5 * 5 *
6 * Copyright (C) 2003, Ethan Blanton <eblanton@cs.purdue.edu> 6 * Copyright (C) 2003, Ethan Blanton <eblanton@cs.purdue.edu>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
12 * 12 *
334 if (irc_ischannel(args[0])) 334 if (irc_ischannel(args[0]))
335 return 0; 335 return 0;
336 stamp = g_strdup_printf("\001PING %lu\001", time(NULL)); 336 stamp = g_strdup_printf("\001PING %lu\001", time(NULL));
337 buf = irc_format(irc, "vn:", "PRIVMSG", args[0], stamp); 337 buf = irc_format(irc, "vn:", "PRIVMSG", args[0], stamp);
338 g_free(stamp); 338 g_free(stamp);
339 } else { 339 } else if (target) {
340 stamp = g_strdup_printf("%s %lu", target, time(NULL)); 340 stamp = g_strdup_printf("%s %lu", target, time(NULL));
341 buf = irc_format(irc, "v:", "PING", stamp); 341 buf = irc_format(irc, "v:", "PING", stamp);
342 g_free(stamp);
343 } else {
344 stamp = g_strdup_printf("%lu", time(NULL));
345 buf = irc_format(irc, "vv", "PING", stamp);
342 g_free(stamp); 346 g_free(stamp);
343 } 347 }
344 irc_send(irc, buf); 348 irc_send(irc, buf);
345 g_free(buf); 349 g_free(buf);
346 350