comparison libpurple/protocols/msn/user.h @ 29368:746bf7d8b34e

Combine the CurrentMedia and MsnUserPhoneInfo structs. This makes MsnUser smaller by the size of one pointer. Since both of these structs are used only rarely, this ends up saving memory for most people.
author Mark Doliner <mark@kingant.net>
date Fri, 05 Feb 2010 02:19:22 +0000
parents 7f5a406a3b50
children 462cb893521b 1830fa548302
comparison
equal deleted inserted replaced
29367:e137c1fc216a 29368:746bf7d8b34e
51 CURRENT_MEDIA_MUSIC, 51 CURRENT_MEDIA_MUSIC,
52 CURRENT_MEDIA_GAMES, 52 CURRENT_MEDIA_GAMES,
53 CURRENT_MEDIA_OFFICE 53 CURRENT_MEDIA_OFFICE
54 } CurrentMediaType; 54 } CurrentMediaType;
55 55
56 typedef struct _CurrentMedia 56 /**
57 * Contains optional info about a user that is fairly uncommon. We
58 * put this info in in a separate struct to save memory because we
59 * allocate an MsnUser struct for each buddy, but we generally only
60 * need this information for a small percentage of our buddies
61 * (usually less than 1%). Putting it in a separate struct saves
62 * makes MsnUser smaller by the size of a few pointers.
63 */
64 typedef struct _MsnUserExtendedInfo
57 { 65 {
58 CurrentMediaType type; /**< Type. */ 66 CurrentMediaType media_type; /**< Type of the user's current media. */
59 char *title; /**< Title. */ 67 char *media_title; /**< Title of the user's current media. */
60 char *artist; /**< Artist. */ 68 char *media_artist; /**< Artist of the user's current media. */
61 char *album; /**< Album. */ 69 char *media_album; /**< Album of the user's current media. */
62 } CurrentMedia; 70
63 71 char *phone_home; /**< E.T. uses this. */
64 typedef struct _MsnUserPhoneInfo 72 char *phone_work; /**< Work phone number. */
65 { 73 char *phone_mobile; /**< Mobile phone number. */
66 char *home; /**< Home phone number. */ 74 } MsnUserExtendedInfo;
67 char *work; /**< Work phone number. */
68 char *mobile; /**< Mobile phone number. */
69 } MsnUserPhoneInfo;
70 75
71 /** 76 /**
72 * A user. 77 * A user.
73 */ 78 */
74 struct _MsnUser 79 struct _MsnUser
80 85
81 char *uid; /*< User ID */ 86 char *uid; /*< User ID */
82 87
83 const char *status; /**< The state of the user. */ 88 const char *status; /**< The state of the user. */
84 char *statusline; /**< The state of the user. */ 89 char *statusline; /**< The state of the user. */
85 CurrentMedia *media; /**< Current media of the user. */
86 90
87 gboolean idle; /**< The idle state of the user. */ 91 gboolean idle; /**< The idle state of the user. */
88 92
89 MsnUserPhoneInfo *phone; /**< This user's phone numbers. */ 93 MsnUserExtendedInfo *extinfo; /**< Extended info for the user. */
90 94
91 gboolean authorized; /**< Authorized to add this user. */ 95 gboolean authorized; /**< Authorized to add this user. */
92 gboolean mobile; /**< Signed up with MSN Mobile. */ 96 gboolean mobile; /**< Signed up with MSN Mobile. */
93 97
94 GList *group_ids; /**< The group IDs. */ 98 GList *group_ids; /**< The group IDs. */
153 * @param user The user. 157 * @param user The user.
154 * @param state The statusline string. 158 * @param state The statusline string.
155 */ 159 */
156 void msn_user_set_statusline(MsnUser *user, const char *statusline); 160 void msn_user_set_statusline(MsnUser *user, const char *statusline);
157 161
158 /**
159 * Sets the current media of user.
160 *
161 * @param user The user.
162 * @param cmedia Current media. This function takes ownership of this
163 * object and its contents.
164 */
165 void msn_user_set_currentmedia(MsnUser *user, CurrentMedia *cmedia);
166
167 /** 162 /**
168 * Sets the new state of user. 163 * Sets the new state of user.
169 * 164 *
170 * @param user The user. 165 * @param user The user.
171 * @param state The state string. 166 * @param state The state string.