comparison libpurple/connection.c @ 28285:dab0d17dc6c1

Minor cleanup. gc->prpl is guarranteed to be a PurplePlugin with type PURPLE_PLUGIN_PROTOCOL
author Mark Doliner <mark@kingant.net>
date Tue, 22 Sep 2009 06:01:08 +0000
parents 815d9ce1a8b0
children 378cceb9131d
comparison
equal deleted inserted replaced
28284:7983230cc1c0 28285:dab0d17dc6c1
50 50
51 static gboolean 51 static gboolean
52 send_keepalive(gpointer data) 52 send_keepalive(gpointer data)
53 { 53 {
54 PurpleConnection *gc = data; 54 PurpleConnection *gc = data;
55 PurplePluginProtocolInfo *prpl_info = NULL; 55 PurplePluginProtocolInfo *prpl_info;
56
57 if (gc == NULL)
58 return TRUE;
59 56
60 /* Only send keep-alives if we haven't heard from the 57 /* Only send keep-alives if we haven't heard from the
61 * server in a while. 58 * server in a while.
62 */ 59 */
63 if ((time(NULL) - gc->last_received) < KEEPALIVE_INTERVAL) 60 if ((time(NULL) - gc->last_received) < KEEPALIVE_INTERVAL)
64 return TRUE; 61 return TRUE;
65 62
66 if (gc->prpl == NULL)
67 return TRUE;
68
69 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); 63 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
70 64 if (prpl_info->keepalive)
71 if (prpl_info && prpl_info->keepalive)
72 prpl_info->keepalive(gc); 65 prpl_info->keepalive(gc);
73 66
74 return TRUE; 67 return TRUE;
75 } 68 }
76 69