| 1 | /* |
| 2 | * Copyright (C) 2007 Colin DIDIER |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License along |
| 14 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 16 | */ |
| 17 | |
| 18 | #include "module.h" |
| 19 | #include "levels.h" |
| 20 | #include "printtext.h" |
| 21 | #include "signals.h" |
| 22 | #include "fe-common/irc/module-formats.h" |
| 23 | |
| 24 | #include "xmpp-servers.h" |
| 25 | #include "rosters-tools.h" |
| 26 | #include "../module-formats.h" |
| 27 | |
| 28 | static void |
| 29 | sig_ping(XMPP_SERVER_REC *server, const char *jid, long usecs) |
| 30 | { |
| 31 | printformat_module(IRC_MODULE_NAME, server, jid, MSGLEVEL_CRAP, |
| 32 | IRCTXT_CTCP_PING_REPLY, jid, usecs/1000, usecs%1000); |
| 33 | } |
| 34 | |
| 35 | void |
| 36 | fe_ping_init(void) |
| 37 | { |
| 38 | signal_add("xmpp ping", sig_ping); |
| 39 | } |
| 40 | |
| 41 | void |
| 42 | fe_ping_deinit(void) |
| 43 | { |
| 44 | signal_remove("xmpp ping", sig_ping); |
| 45 | } |