annotate src/protocols/sametime/meanwhile/mw_util.h @ 10969:3ef77720e577

[gaim-migrate @ 12790] importing meanwhile library for use in the sametime plugin committer: Tailor Script <tailor@pidgin.im>
author Christopher O'Brien <siege@pidgin.im>
date Sun, 05 Jun 2005 02:50:13 +0000
parents
children d6417efb990c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10969
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
1
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
2 /*
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
3 Meanwhile - Unofficial Lotus Sametime Community Client Library
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
4 Copyright (C) 2004 Christopher (siege) O'Brien
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
5
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
6 This library is free software; you can redistribute it and/or
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
7 modify it under the terms of the GNU Library General Public
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
8 License as published by the Free Software Foundation; either
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
9 version 2 of the License, or (at your option) any later version.
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
10
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
11 This library is distributed in the hope that it will be useful,
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
14 Library General Public License for more details.
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
15
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
16 You should have received a copy of the GNU Library General Public
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
17 License along with this library; if not, write to the Free
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
19 */
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
20
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
21 #ifndef _MW_UTIL_H
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
22 #define _MW_UTIL_H
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
23
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
24
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
25 #include <glib.h>
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
26 #include <glib/ghash.h>
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
27 #include <glib/glist.h>
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
28
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
29
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
30 #define map_guint_new() \
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
31 g_hash_table_new(g_direct_hash, g_direct_equal)
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
32
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
33
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
34 #define map_guint_new_full(valfree) \
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
35 g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (valfree))
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
36
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
37
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
38 #define map_guint_insert(ht, key, val) \
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
39 g_hash_table_insert((ht), GUINT_TO_POINTER((guint)(key)), (val))
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
40
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
41
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
42 #define map_guint_replace(ht, key, val) \
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
43 g_hash_table_replace((ht), GUINT_TO_POINTER((guint)(key)), (val))
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
44
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
45
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
46 #define map_guint_lookup(ht, key) \
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
47 g_hash_table_lookup((ht), GUINT_TO_POINTER((guint)(key)))
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
48
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
49
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
50 #define map_guint_remove(ht, key) \
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
51 g_hash_table_remove((ht), GUINT_TO_POINTER((guint)(key)))
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
52
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
53
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
54 #define map_guint_steal(ht, key) \
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
55 g_hash_table_steal((ht), GUINT_TO_POINTER((guint)(key)))
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
56
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
57
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
58 GList *map_collect_keys(GHashTable *ht);
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
59
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
60
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
61 GList *map_collect_values(GHashTable *ht);
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
62
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
63
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
64 struct mw_datum {
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
65 gpointer data;
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
66 GDestroyNotify clear;
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
67 };
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
68
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
69
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
70 struct mw_datum *mw_datum_new(gpointer data, GDestroyNotify clear);
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
71
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
72
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
73 void mw_datum_set(struct mw_datum *d, gpointer data, GDestroyNotify clear);
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
74
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
75
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
76 gpointer mw_datum_get(struct mw_datum *d);
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
77
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
78
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
79 void mw_datum_clear(struct mw_datum *d);
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
80
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
81
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
82 void mw_datum_free(struct mw_datum *d);
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
83
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
84
3ef77720e577 [gaim-migrate @ 12790]
Christopher O'Brien <siege@pidgin.im>
parents:
diff changeset
85 #endif