Mercurial > pidgin.yaz
changeset 19244:b29788c6d269
Make msimprpl work without a libpurple attention API.
Change PurpleAttentionType to MsimAttentionType and define it in
myspace.h, so that msimprpl can use it while libpurple doesn't have it.
author | Jeffrey Connelly <jaconnel@calpoly.edu> |
---|---|
date | Tue, 14 Aug 2007 03:03:52 +0000 |
parents | a242e014ab8c |
children | d7eea5c20cf9 |
files | libpurple/protocols/myspace/myspace.c libpurple/protocols/myspace/myspace.h |
diffstat | 2 files changed, 28 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c Tue Aug 14 02:54:31 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.c Tue Aug 14 03:03:52 2007 +0000 @@ -287,11 +287,11 @@ msim_attention_types(PurpleAccount *acct) { static GList *types = NULL; - PurpleAttentionType* attn; + MsimAttentionType* attn; if (!types) { #define _MSIM_ADD_NEW_ATTENTION(icn, des, incoming, outgoing) \ - attn = g_new0(PurpleAttentionType, 1); \ + attn = g_new0(MsimAttentionType, 1); \ attn->icon = icn; \ attn->description = des; \ attn->incoming_description = incoming; \ @@ -320,14 +320,14 @@ { GList *types; MsimSession *session; - PurpleAttentionType *attn; + MsimAttentionType *attn; PurpleBuddy *buddy; session = (MsimSession *)gc->proto_data; /* Look for this attention type, by the code index given. */ types = msim_attention_types(gc->account); - attn = (PurpleAttentionType *)g_list_nth_data(types, code); + attn = (MsimAttentionType *)g_list_nth_data(types, code); if (!attn) { purple_debug_info("msim_send_attention", "got invalid zap code %d\n", code); @@ -339,7 +339,7 @@ return FALSE; } - /* TODO: make use of the PurpleAttentionType we found, instead of + /* TODO: make use of the MsimAttentionType we found, instead of * doing it all over in msim_send_zap_from_menu. */ msim_send_zap_from_menu(&buddy->node, GUINT_TO_POINTER(code)); @@ -355,7 +355,7 @@ gchar *zap_description; #endif GList *types; - PurpleAttentionType *attn; + MsimAttentionType *attn; gboolean rc; g_return_val_if_fail(session != NULL, FALSE); @@ -449,9 +449,9 @@ i = 0; do { - PurpleAttentionType *attn; - - attn = (PurpleAttentionType *)types->data; + MsimAttentionType *attn; + + attn = (MsimAttentionType *)types->data; zap_names[i] = attn->description; ++i; } while ((types = g_list_next(types))); @@ -1686,7 +1686,7 @@ gint zap; const gchar *zap_past_tense[10]; #ifdef MSIM_USE_ATTENTION_API - PurpleAttentionType attn; + MsimAttentionType attn; #else gchar *zap_text; #endif
--- a/libpurple/protocols/myspace/myspace.h Tue Aug 14 02:54:31 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.h Tue Aug 14 03:03:52 2007 +0000 @@ -68,7 +68,8 @@ /*#define MSIM_SELF_TEST */ /* Use the attention API for zaps? */ -#define MSIM_USE_ATTENTION_API +/* Can't have until >=2.2.0, since is a new API. */ +/*#define MSIM_USE_ATTENTION_API */ /* Constants */ @@ -202,6 +203,9 @@ guint inbox_status; /**< Bit field of inbox notifications */ } MsimSession; +/* Check if an MsimSession is valid */ +#define MSIM_SESSION_VALID(s) (session != NULL && session->magic == MSIM_SESSION_STRUCT_MAGIC) + /* Hold ephemeral information about buddies, for proto_data of PurpleBuddy. */ /* GHashTable? */ typedef struct _MsimUser @@ -221,8 +225,19 @@ gchar *image_url; } MsimUser; -/* Check if an MsimSession is valid */ -#define MSIM_SESSION_VALID(s) (session != NULL && session->magic == MSIM_SESSION_STRUCT_MAGIC) + +/* Different kinds of attention alerts. Not yet in libpurple, so define + * our own structure here. */ +typedef struct _MsimAttentionType MsimAttentionType; + +/** A type of "attention" message (zap, nudge, buzz, etc. depending on the + * protocol) that can be sent and received. */ +struct _MsimAttentionType { + PurpleStoredImage *icon; + const gchar *description; /**< Shown before sending. */ + const gchar *incoming_description; /**< Shown when sent. */ + const gchar *outgoing_description; /**< Shown when received. */ +}; gchar *str_replace(const gchar *str, const gchar *old, const gchar *new);