]>
Commit | Line | Data |
---|---|---|
1aaf3b37 | 1 | diff -ur leafnode-ekg2-bd26d9a-orig/plugins/irc/irc.c leafnode-ekg2-bd26d9a/plugins/irc/irc.c |
2 | --- leafnode-ekg2-bd26d9a-orig/plugins/irc/irc.c 2011-05-21 13:19:15.000000000 +0200 | |
3 | +++ leafnode-ekg2-bd26d9a/plugins/irc/irc.c 2011-07-05 09:32:19.636396656 +0200 | |
4 | @@ -571,6 +571,24 @@ | |
5 | irc_handle_disconnect(s, err->message, EKG_DISCONNECT_FAILURE); | |
6 | } | |
7 | ||
8 | +static TIMER_SESSION(irc_ping_timer_handler) { | |
9 | + irc_private_t *j; | |
10 | + GTimeVal tv; | |
11 | + | |
12 | + if (type == 1) | |
13 | + return 0; | |
14 | + | |
15 | + if (!s || !s->connected) | |
16 | + return -1; | |
17 | + | |
18 | + j = irc_private(s); | |
19 | + | |
20 | + g_get_current_time(&tv); | |
21 | + ekg_connection_write(j->send_stream, "PRIVMSG %s :\01PING %d %d\01\r\n", | |
22 | + j->nick ,tv.tv_sec, tv.tv_usec); | |
23 | + return 0; | |
24 | +} | |
25 | + | |
26 | ||
27 | /* * | |
28 | * ======================================== COMMANDS ------------------- * | |
29 | @@ -599,6 +617,12 @@ | |
30 | ||
31 | if (session_status_get(session) == EKG_STATUS_NA) | |
32 | session_status_set(session, EKG_STATUS_AVAIL); | |
33 | + | |
34 | + if(timer_find_session(session, "ping") == NULL) { | |
35 | + /* ping irc server for every 30 minutes */ | |
36 | + timer_add_session(session, "ping", 30*60, 1, irc_ping_timer_handler); | |
37 | + } | |
38 | + | |
39 | ||
40 | /* XXX: timeout */ | |
41 | return -1; | |
42 | Tylko w leafnode-ekg2-bd26d9a/plugins/irc: irc.c~ |