Mercurial > pidgin.yaz
changeset 17382:1a26b36889dc
Implement msim_get_info() for users on the user's buddy list.
author | Jeffrey Connelly <jaconnel@calpoly.edu> |
---|---|
date | Thu, 14 Jun 2007 06:06:56 +0000 |
parents | df93e8773981 |
children | f057837085b0 |
files | libpurple/protocols/myspace/myspace.c libpurple/protocols/myspace/myspace.h |
diffstat | 2 files changed, 65 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c Thu Jun 14 01:53:58 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.c Thu Jun 14 06:06:56 2007 +0000 @@ -713,7 +713,6 @@ * @param name The buddy name to which our user is typing to * @param state PURPLE_TYPING, PURPLE_TYPED, PURPLE_NOT_TYPING * - * NOT CURRENTLY USED OR COMPLETE */ unsigned int msim_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state) { @@ -740,6 +739,69 @@ return 0; } +/** Retrieve a user's profile. */ +void msim_get_info(PurpleConnection *gc, const char *name) +{ + PurpleNotifyUserInfo *user_info; + PurpleBuddy *buddy; + MsimSession *session; + + session = (MsimSession *)gc->proto_data; + + user_info = purple_notify_user_info_new(); + + buddy = purple_find_buddy(session->account, name); + if (!buddy) + { + /* TODO: profile of buddies not on blist! */ + purple_notify_user_info_add_pair(user_info, NULL, + "Sorry, currently user information can only be retrieved from users on your buddy list."); + purple_notify_userinfo(gc, name, user_info, NULL, NULL); + purple_notify_user_info_destroy(user_info); + return; + } + + + /* Identification */ + purple_notify_user_info_add_pair(user_info, "User Name", + purple_blist_node_get_string(&buddy->node, "UserName")); + + + purple_notify_user_info_add_pair(user_info, "User ID", + g_strdup_printf("%d", purple_blist_node_get_int(&buddy->node, "UserID"))); + + purple_notify_user_info_add_pair(user_info, "Display Name", + purple_blist_node_get_string(&buddy->node, "DisplayName")); + + + /* a/s/l...the vitals */ + purple_notify_user_info_add_pair(user_info, "Age", + g_strdup_printf("%d", purple_blist_node_get_int(&buddy->node, "Age"))); + + purple_notify_user_info_add_pair(user_info, "Gender", + purple_blist_node_get_string(&buddy->node, "Gender")); + + purple_notify_user_info_add_pair(user_info, "Location", + purple_blist_node_get_string(&buddy->node, "Location")); + + /* Other information */ + if (purple_blist_node_get_string(&buddy->node, "Headline")) + purple_notify_user_info_add_pair(user_info, "Headline", + purple_blist_node_get_string(&buddy->node, "Headline")); + + purple_notify_user_info_add_pair(user_info, "Song", + g_strdup_printf("%s - %s", + purple_blist_node_get_string(&buddy->node, "BandName"), + purple_blist_node_get_string(&buddy->node, "SongName"))); + + purple_notify_user_info_add_pair(user_info, "Total Friends", + g_strdup_printf("%d", purple_blist_node_get_int(&buddy->node, "TotalFriends"))); + + + purple_notify_userinfo(gc, name, user_info, NULL, NULL); + purple_notify_user_info_destroy(user_info); +} + /** After a uid is resolved to username, tag it with the username and submit for processing. * * @param session @@ -2030,7 +2092,7 @@ msim_send_im, /* send_im */ NULL, /* set_info */ msim_send_typing, /* send_typing */ - NULL, /* get_info */ + msim_get_info, /* get_info */ NULL, /* set_away */ NULL, /* set_idle */ NULL, /* change_passwd */
--- a/libpurple/protocols/myspace/myspace.h Thu Jun 14 01:53:58 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.h Thu Jun 14 06:06:56 2007 +0000 @@ -163,6 +163,7 @@ int msim_incoming_action(MsimSession *session, MsimMessage *msg); unsigned int msim_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state); +void msim_get_info(PurpleConnection *gc, const char *name); void msim_store_buddy_info_each(gpointer key, gpointer value, gpointer user_data); gboolean msim_store_buddy_info(MsimSession *session, MsimMessage *msg);