Protocol Plugin Development Problem - Status Types
Ralf Kistner
ralfgm at gmail.com
Sat Nov 24 06:13:48 EST 2007
Hi,
I'm busy developing a plugin for the MXit protocol (www.mxit.co.za). At the moment I'm stuck with a small problem with status types.
The protocol uses the same status types as XMPP:
- Available
- Chatty
- Away
- Extended away
- Do Not Disturb
- Offline
In my test setup, I have two accounts: one MXit and one XMPP. When I have either one enabled, the status types work fine.
However, when I have both accounts enabled at the same time, I can only set my status to one of the following:
- Available
- Away
- Do not disturb (case changes)
- Invisible (where does this come from?)
- Offline
"Chatty" and "Extended Away" are missing. Why this change when I enable both accounts?
I'm using Pidgin 2.2.1 compiled on Ubuntu 7.10.
Regards,
Ralf Kistner
------------------------------------------------------------------------
The code for the status types of both protocols:
static GList *mxitprpl_status_types(PurpleAccount *acct)
{
GList *types = NULL;
PurpleStatusType *type;
type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE,
MXIT_STATUS_AVAILABLE, //This is the same value that jabber_buddy_state_get_status_id returns for each type
NULL, TRUE, TRUE, FALSE,
"mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
NULL);
types = g_list_append(types, type);
type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE,
MXIT_STATUS_CHAT,
_("Chatty"), TRUE, TRUE, FALSE,
"mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
NULL);
types = g_list_append(types, type);
type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY,
MXIT_STATUS_AWAY,
NULL, TRUE, TRUE, FALSE,
"mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
NULL);
types = g_list_append(types, type);
type = purple_status_type_new_with_attrs(PURPLE_STATUS_EXTENDED_AWAY,
MXIT_STATUS_XA,
NULL, TRUE, TRUE, FALSE,
"mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
NULL);
types = g_list_append(types, type);
type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE,
MXIT_STATUS_DND,
_("Do Not Disturb"), TRUE, TRUE, FALSE,
"mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
NULL);
types = g_list_append(types, type);
type = purple_status_type_new(PURPLE_STATUS_OFFLINE,
MXIT_STATUS_OFFLINE,
NULL, TRUE);
types = g_list_append(types, type);
return types;
}
GList *jabber_status_types(PurpleAccount *account)
{
PurpleStatusType *type;
GList *types = NULL;
PurpleValue *priority_value;
priority_value = purple_value_new(PURPLE_TYPE_INT);
purple_value_set_int(priority_value, 1);
type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE,
jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_ONLINE),
NULL, TRUE, TRUE, FALSE,
"priority", _("Priority"), priority_value,
"message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
"mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
"moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(PURPLE_TYPE_INT),
PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(PURPLE_TYPE_INT),
PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING),
"nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
"buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN),
NULL);
types = g_list_append(types, type);
priority_value = purple_value_new(PURPLE_TYPE_INT);
purple_value_set_int(priority_value, 1);
type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE,
jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_CHAT),
_("Chatty"), TRUE, TRUE, FALSE,
"priority", _("Priority"), priority_value,
"message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
"mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
"moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(PURPLE_TYPE_INT),
PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(PURPLE_TYPE_INT),
PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING),
"nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
"buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN),
NULL);
types = g_list_append(types, type);
priority_value = purple_value_new(PURPLE_TYPE_INT);
purple_value_set_int(priority_value, 0);
type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY,
jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_AWAY),
NULL, TRUE, TRUE, FALSE,
"priority", _("Priority"), priority_value,
"message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
"mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
"moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(PURPLE_TYPE_INT),
PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(PURPLE_TYPE_INT),
PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING),
"nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
"buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN),
NULL);
types = g_list_append(types, type);
priority_value = purple_value_new(PURPLE_TYPE_INT);
purple_value_set_int(priority_value, 0);
type = purple_status_type_new_with_attrs(PURPLE_STATUS_EXTENDED_AWAY,
jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_XA),
NULL, TRUE, TRUE, FALSE,
"priority", _("Priority"), priority_value,
"message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
"mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
"moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(PURPLE_TYPE_INT),
PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(PURPLE_TYPE_INT),
PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING),
"nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
"buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN),
NULL);
types = g_list_append(types, type);
priority_value = purple_value_new(PURPLE_TYPE_INT);
purple_value_set_int(priority_value, 0);
type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE,
jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_DND),
_("Do Not Disturb"), TRUE, TRUE, FALSE,
"priority", _("Priority"), priority_value,
"message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
"mood", _("Mood"), purple_value_new(PURPLE_TYPE_STRING),
"moodtext", _("Mood Text"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_ARTIST, _("Tune Artist"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TITLE, _("Tune Title"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_ALBUM, _("Tune Album"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_GENRE, _("Tune Genre"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_COMMENT, _("Tune Comment"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TRACK, _("Tune Track"), purple_value_new(PURPLE_TYPE_STRING),
PURPLE_TUNE_TIME, _("Tune Time"), purple_value_new(PURPLE_TYPE_INT),
PURPLE_TUNE_YEAR, _("Tune Year"), purple_value_new(PURPLE_TYPE_INT),
PURPLE_TUNE_URL, _("Tune URL"), purple_value_new(PURPLE_TYPE_STRING),
"nick", _("Nickname"), purple_value_new(PURPLE_TYPE_STRING),
"buzz", _("Allow Buzz"), purple_value_new(PURPLE_TYPE_BOOLEAN),
NULL);
types = g_list_append(types, type);
/*
if(js->protocol_version == JABBER_PROTO_0_9)
m = g_list_append(m, _("Invisible"));
*/
type = purple_status_type_new_with_attrs(PURPLE_STATUS_OFFLINE,
jabber_buddy_state_get_status_id(JABBER_BUDDY_STATE_UNAVAILABLE),
NULL, FALSE, TRUE, FALSE,
"message", _("Message"), purple_value_new(PURPLE_TYPE_STRING),
NULL);
types = g_list_append(types, type);
return types;
}
More information about the Devel
mailing list