Current media: Status attribute, or independant status type?

Sadrul Habib Chowdhury imadil at gmail.com
Thu Sep 20 08:25:50 EDT 2007


Hi. In libpurple, we have some support for 'User listening to: Song by
Artist' in xmpp and in the new msn prpl. This is done my adding status
attributes to all the status types like this:

(this is from xmpp, and just as an example)

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),

and this is done for all the other status types (eg. _STATUS_AWAY etc.).
I think it makes more sense to create an independent status type "tune"
with the appropriate attributes, like so:

type = purple_status_type_new_with_attrs(PURPLE_STATUS_TUNE,
	"tune", NULL, FALSE, FALSE, TRUE,
	PURPLE_TUNE_ARTIST, _("Artist"), purple_value_new(PURPLE_TYPE_STRING),
	PURPLE_TUNE_ALBUM, _("Album"), purple_value_new(PURPLE_TYPE_STRING),
	PURPLE_TUNE_TITLE, _("Title"), purple_value_new(PURPLE_TYPE_STRING),
	NULL);

Since this is an independant status type, it can be turned on and off
irrespective of the active primarty status (_AVAILABLE, _AWAY etc.).
This is how it's done for the 'mobile' status, and I think it makes more
sense, and makes the code more manageable, to do the same for 'tune'.

Any opinions?

(PS: This adds a new enum, so we would need to bump the minor)

Sadrul




More information about the Devel mailing list