From 4b30518d4f8b96d95e004829e7a4ebed4b67930c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Sep 2009 17:26:36 -0500 Subject: Putting in the TP Connection enum map --- src/status-provider-mc5.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src') 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 . #include -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; } -- cgit v1.2.3