diff -ur leafnode-ekg2-bd26d9a-orig/plugins/irc/irc.c leafnode-ekg2-bd26d9a/plugins/irc/irc.c --- leafnode-ekg2-bd26d9a-orig/plugins/irc/irc.c 2011-05-21 13:19:15.000000000 +0200 +++ leafnode-ekg2-bd26d9a/plugins/irc/irc.c 2011-07-05 09:32:19.636396656 +0200 @@ -571,6 +571,24 @@ irc_handle_disconnect(s, err->message, EKG_DISCONNECT_FAILURE); } +static TIMER_SESSION(irc_ping_timer_handler) { + irc_private_t *j; + GTimeVal tv; + + if (type == 1) + return 0; + + if (!s || !s->connected) + return -1; + + j = irc_private(s); + + g_get_current_time(&tv); + ekg_connection_write(j->send_stream, "PRIVMSG %s :\01PING %d %d\01\r\n", + j->nick ,tv.tv_sec, tv.tv_usec); + return 0; +} + /* * * ======================================== COMMANDS ------------------- * @@ -599,6 +617,12 @@ if (session_status_get(session) == EKG_STATUS_NA) session_status_set(session, EKG_STATUS_AVAIL); + + if(timer_find_session(session, "ping") == NULL) { + /* ping irc server for every 30 minutes */ + timer_add_session(session, "ping", 30*60, 1, irc_ping_timer_handler); + } + /* XXX: timeout */ return -1; Tylko w leafnode-ekg2-bd26d9a/plugins/irc: irc.c~