aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/status-provider-mc5.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/status-provider-mc5.c b/src/status-provider-mc5.c
index 8ee174b..0251675 100644
--- a/src/status-provider-mc5.c
+++ b/src/status-provider-mc5.c
@@ -32,7 +32,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <dbus/dbus-glib.h>
-static gchar * sp_to_mc_map[] = {
+static gchar * sp_to_mc_map[STATUS_PROVIDER_STATUS_LAST] = {
/* STATUS_PROVIDER_STATUS_ONLINE, */ "available",
/* STATUS_PROVIDER_STATUS_AWAY, */ "away",
/* STATUS_PROVIDER_STATUS_DND */ "busy",
@@ -41,7 +41,7 @@ static gchar * sp_to_mc_map[] = {
/* STATUS_PROVIDER_STATUS_DISCONNECTED*/NULL
};
-static TpConnectionPresenceType sp_to_tp_map[] = {
+static TpConnectionPresenceType sp_to_tp_map[STATUS_PROVIDER_STATUS_LAST] = {
/* STATUS_PROVIDER_STATUS_ONLINE, */ TP_CONNECTION_PRESENCE_TYPE_AVAILABLE,
/* STATUS_PROVIDER_STATUS_AWAY, */ TP_CONNECTION_PRESENCE_TYPE_AWAY,
/* STATUS_PROVIDER_STATUS_DND */ TP_CONNECTION_PRESENCE_TYPE_BUSY,
@@ -50,6 +50,18 @@ static TpConnectionPresenceType sp_to_tp_map[] = {
/* STATUS_PROVIDER_STATUS_DISCONNECTED*/ TP_CONNECTION_PRESENCE_TYPE_UNSET
};
+static StatusProviderStatus tp_to_sp_map[TP_CONNECTION_PRESENCE_TYPE_ERROR + 1] = {
+ /* TP_CONNECTION_PRESENCE_TYPE_UNSET */ STATUS_PROVIDER_STATUS_DISCONNECTED,
+ /* TP_CONNECTION_PRESENCE_TYPE_OFFLINE */ STATUS_PROVIDER_STATUS_OFFLINE,
+ /* TP_CONNECTION_PRESENCE_TYPE_AVAILABLE */ STATUS_PROVIDER_STATUS_ONLINE,
+ /* TP_CONNECTION_PRESENCE_TYPE_AWAY */ STATUS_PROVIDER_STATUS_AWAY,
+ /* TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY */ STATUS_PROVIDER_STATUS_AWAY,
+ /* TP_CONNECTION_PRESENCE_TYPE_HIDDEN */ STATUS_PROVIDER_STATUS_INVISIBLE,
+ /* TP_CONNECTION_PRESENCE_TYPE_BUSY */ STATUS_PROVIDER_STATUS_DND,
+ /* TP_CONNECTION_PRESENCE_TYPE_UNKNOWN */ STATUS_PROVIDER_STATUS_DISCONNECTED,
+ /* TP_CONNECTION_PRESENCE_TYPE_ERROR */ STATUS_PROVIDER_STATUS_DISCONNECTED
+};
+
typedef struct _StatusProviderMC5Private StatusProviderMC5Private;
struct _StatusProviderMC5Private {
EmpathyAccountManager * manager;
@@ -176,7 +188,7 @@ presence_changed (EmpathyAccountManager * eam, guint type, const gchar * type_st
g_debug("MC5 Status changed: %d %s %s", type, type_str, message);
- priv->status = type;
+ priv->status = tp_to_sp_map[type];
return;
}