Mercurial > hg
comparison mcabber/src/hooks.c @ 113:8ac67e951eab
[/trunk] Changeset 127 by mikael
* Add a "hooks" layer.
Hooks are used when multiples operations should be done when an event
araises. For example message in/out, status change...
2 more files; Makefile updated.
* Logging is ready.
* Add 2 options:
- "logging" (bool): enable/disable history logging
- "logging_dir" (char): root dir for logging files
* Document pinginterval (keepalive) in the sample config file.
* Send keepalive only when online.
author | mikael |
---|---|
date | Sun, 24 Apr 2005 20:24:18 +0000 |
parents | |
children | 33bff2c57293 |
comparison
equal
deleted
inserted
replaced
112:edb5591e2e64 | 113:8ac67e951eab |
---|---|
1 /* | |
2 * hooks.c -- Hooks layer | |
3 * | |
4 * Copyright (C) 2005 Mikael Berthe <bmikael@lists.lilotux.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or (at | |
9 * your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, but | |
12 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 * General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |
19 * USA | |
20 */ | |
21 | |
22 #include <screen.h> | |
23 | |
24 #include "hooks.h" | |
25 #include "roster.h" | |
26 #include "histolog.h" | |
27 | |
28 | |
29 inline void hk_message_in(const char *jid, time_t timestamp, const char *msg) | |
30 { | |
31 scr_WriteIncomingMessage(jid, msg); | |
32 hlog_write_message(jid, timestamp, FALSE, msg); | |
33 } | |
34 | |
35 inline void hk_message_out(const char *jid, time_t timestamp, const char *msg) | |
36 { | |
37 scr_WriteOutgoingMessage(jid, msg); | |
38 hlog_write_message(jid, timestamp, TRUE, msg); | |
39 } | |
40 | |
41 inline void hk_statuschange(const char *jid, time_t timestamp, | |
42 enum imstatus status) | |
43 { | |
44 scr_LogPrint("Buddy status has changed: [%c>%c] <%s>", | |
45 imstatus2char[roster_getstatus(jid)], imstatus2char[status], jid); | |
46 roster_setstatus(jid, status); | |
47 hlog_write_status(jid, 0, status); | |
48 } | |
49 |