Mercurial > pidgin
comparison libpurple/protocols/myspace/user.c @ 25983:9ea3474065dc
propagate from branch 'im.pidgin.pidgin' (head 303af74a38e7b313d4fb0be4d4054a16cb13d819)
to branch 'im.pidgin.cpw.darkrain42.buddy-add' (head 8c6ff5a8cf91db250e9440fa0acab89d7fefe4ac)
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 07 Mar 2009 01:23:51 +0000 |
parents | c0b42d6c2785 ae544623840b |
children | 324cc0d6ca0a |
comparison
equal
deleted
inserted
replaced
25977:0e93bbb7f5ca | 25983:9ea3474065dc |
---|---|
39 return NULL; | 39 return NULL; |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 /** | 43 /** |
44 * Get the MsimUser from a PurpleBuddy, creating it if needed. | 44 * Get the MsimUser from a PurpleBuddy, optionally creating it if needed. |
45 */ | 45 */ |
46 MsimUser * | 46 MsimUser * |
47 msim_get_user_from_buddy(PurpleBuddy *buddy) | 47 msim_get_user_from_buddy(PurpleBuddy *buddy, gboolean create) |
48 { | 48 { |
49 MsimUser *user; | 49 MsimUser *user; |
50 | 50 |
51 if (!buddy) { | 51 if (!buddy) { |
52 return NULL; | 52 return NULL; |
53 } | 53 } |
54 | 54 |
55 if (!(user = purple_buddy_get_protocol_data(buddy))) { | 55 user = purple_buddy_get_protocol_data(buddy); |
56 if (create && !user) { | |
56 /* No MsimUser for this buddy; make one. */ | 57 /* No MsimUser for this buddy; make one. */ |
57 | 58 |
58 user = g_new0(MsimUser, 1); | 59 user = g_new0(MsimUser, 1); |
59 user->buddy = buddy; | 60 user->buddy = buddy; |
60 purple_buddy_set_protocol_data(buddy, user); | 61 purple_buddy_set_protocol_data(buddy, user); |
92 buddy = purple_find_buddy(session->account, username); | 93 buddy = purple_find_buddy(session->account, username); |
93 if (!buddy) { | 94 if (!buddy) { |
94 return NULL; | 95 return NULL; |
95 } | 96 } |
96 | 97 |
97 user = msim_get_user_from_buddy(buddy); | 98 user = msim_get_user_from_buddy(buddy, TRUE); |
98 | 99 |
99 return user; | 100 return user; |
100 } | 101 } |
101 | 102 |
102 /** | 103 /** |