2 * @file miranda-plugin.c
6 * Copyright (C) 2010 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "sipe-common.h"
28 #include "sipe-backend.h"
29 #include "sipe-core.h"
32 #include "newpluginapi.h"
33 #include "m_protosvc.h"
36 /* Sipe core activity <-> Miranda status mapping */
37 static const gchar
* const activity_to_miranda
[SIPE_ACTIVITY_NUM_TYPES
] = {
38 /* SIPE_ACTIVITY_UNSET */ "unset",
39 /* SIPE_ACTIVITY_ONLINE */ "online",
40 /* SIPE_ACTIVITY_INACTIVE */ "idle",
41 /* SIPE_ACTIVITY_BUSY */ "busy",
42 /* SIPE_ACTIVITY_BUSYIDLE */ "busyidle",
43 /* SIPE_ACTIVITY_DND */ "do-not-disturb",
44 /* SIPE_ACTIVITY_BRB */ "be-right-back",
45 /* SIPE_ACTIVITY_AWAY */ "away",
46 /* SIPE_ACTIVITY_LUNCH */ "out-to-lunch",
47 /* SIPE_ACTIVITY_OFFLINE */ "offline",
48 /* SIPE_ACTIVITY_ON_PHONE */ "on-the-phone",
49 /* SIPE_ACTIVITY_IN_CONF */ "in-a-conference",
50 /* SIPE_ACTIVITY_IN_MEETING */ "in-a-meeting",
51 /* SIPE_ACTIVITY_OOF */ "out-of-office",
52 /* SIPE_ACTIVITY_URGENT_ONLY */ "urgent-interruptions-only",
54 GHashTable
*miranda_to_activity
= NULL
;
55 #define MIRANDA_STATUS_TO_ACTIVITY(x) \
56 GPOINTER_TO_UINT(g_hash_table_lookup(miranda_to_activity, (x)))
58 static void sipe_miranda_activity_init(void)
60 sipe_activity index
= SIPE_ACTIVITY_UNSET
;
61 miranda_to_activity
= g_hash_table_new(g_str_hash
, g_str_equal
);
62 while (index
< SIPE_ACTIVITY_NUM_TYPES
) {
63 g_hash_table_insert(miranda_to_activity
,
64 (gpointer
) activity_to_miranda
[index
],
65 GUINT_TO_POINTER(index
));
70 gchar
*sipe_backend_version(void)
74 if (CallService(MS_SYSTEM_GETVERSIONTEXT
, sizeof(version
), (LPARAM
)version
)) {
75 strcpy(version
, "Unknown");
78 return g_strdup_printf("Miranda %s SipSimple " __DATE__
" " __TIME__
, version
);
81 static void sipe_miranda_activity_destroy(void)
83 g_hash_table_destroy(miranda_to_activity
);
84 miranda_to_activity
= NULL
;