Mercurial > pidgin
annotate src/protocols/msn/user.h @ 5316:d5690ed70085
[gaim-migrate @ 5688]
Added experimental support for the text/x-clientinfo content-type being
discussed on the forums at hypothetic.org. It may change, but for now, I
just want to play with it, and I want us to be able to accept the messages.
Ignore what it consists of right now. It'll change.
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Tue, 06 May 2003 08:54:58 +0000 |
| parents | e2e53316a21d |
| children | ebebc833cf77 |
| rev | line source |
|---|---|
| 5309 | 1 /** |
| 2 * @file user.h User functions | |
| 3 * | |
| 4 * gaim | |
| 5 * | |
| 6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
| 7 * | |
| 8 * This program is free software; you can redistribute it and/or modify | |
| 9 * it under the terms of the GNU General Public License as published by | |
| 10 * the Free Software Foundation; either version 2 of the License, or | |
| 11 * (at your option) any later version. | |
| 12 * | |
| 13 * This program is distributed in the hope that it will be useful, | |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 * GNU General Public License for more details. | |
| 17 * | |
| 18 * You should have received a copy of the GNU General Public License | |
| 19 * along with this program; if not, write to the Free Software | |
| 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 21 */ | |
| 22 #ifndef _MSN_USER_H_ | |
| 23 #define _MSN_USER_H_ | |
| 24 | |
| 25 typedef struct _MsnUser MsnUser; | |
| 26 typedef struct _MsnUsers MsnUsers; | |
| 27 | |
| 28 #include "session.h" | |
| 29 | |
| 30 /** | |
| 31 * A user. | |
| 32 */ | |
| 33 struct _MsnUser | |
| 34 { | |
|
5316
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
35 MsnSession *session; /**< The MSN session. */ |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
36 |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
37 char *passport; /**< The passport account. */ |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
38 char *name; /**< The friendly name. */ |
| 5309 | 39 |
|
5316
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
40 int group_id; /**< The group ID. */ |
| 5309 | 41 |
|
5316
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
42 size_t ref_count; /**< The reference count. */ |
| 5309 | 43 |
|
5316
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
44 GHashTable *clientinfo; /**< The client information. */ |
| 5309 | 45 }; |
| 46 | |
| 47 /** | |
| 48 * A collection of users. | |
| 49 */ | |
| 50 struct _MsnUsers | |
| 51 { | |
| 52 GList *users; /** The list of users. */ | |
| 53 }; | |
| 54 | |
| 55 /** | |
| 56 * Creates a new user structure. | |
| 57 * | |
| 58 * @param session The MSN session. | |
| 59 * @param passport The initial passport. | |
| 60 * @param name The initial friendly name. | |
| 61 * | |
| 62 * @return A new user structure. | |
| 63 */ | |
| 64 MsnUser *msn_user_new(MsnSession *session, const char *passport, | |
| 65 const char *name); | |
| 66 | |
| 67 /** | |
| 68 * Destroys a user structure. | |
| 69 * | |
| 70 * @param user The user to destroy. | |
| 71 */ | |
| 72 void msn_user_destroy(MsnUser *user); | |
| 73 | |
| 74 /** | |
| 75 * Increments the reference count on a user. | |
| 76 * | |
| 77 * @param user The user. | |
| 78 * | |
| 79 * @return @a user | |
| 80 */ | |
| 81 MsnUser *msn_user_ref(MsnUser *user); | |
| 82 | |
| 83 /** | |
| 84 * Decrements the reference count on a user. | |
| 85 * | |
| 86 * This will destroy the structure if the count hits 0. | |
| 87 * | |
| 88 * @param user The user. | |
| 89 * | |
| 90 * @return @a user, or @c NULL if the new count is 0. | |
| 91 */ | |
| 92 MsnUser *msn_user_unref(MsnUser *user); | |
| 93 | |
| 94 /** | |
| 95 * Sets the passport account for a user. | |
| 96 * | |
| 97 * @param user The user. | |
| 98 * @param passport The passport account. | |
| 99 */ | |
| 100 void msn_user_set_passport(MsnUser *user, const char *passport); | |
| 101 | |
| 102 /** | |
| 103 * Sets the friendly name for a user. | |
| 104 * | |
| 105 * @param user The user. | |
| 106 * @param name The friendly name. | |
| 107 */ | |
| 108 void msn_user_set_name(MsnUser *user, const char *name); | |
| 109 | |
| 110 /** | |
| 111 * Sets the group ID for a user. | |
| 112 * | |
| 113 * @param user The user. | |
| 114 * @param id The group ID. | |
| 115 */ | |
| 116 void msn_user_set_group_id(MsnUser *user, int id); | |
| 117 | |
| 118 /** | |
| 119 * Returns the passport account for a user. | |
| 120 * | |
| 121 * @param user The user. | |
| 122 * | |
| 123 * @return The passport account. | |
| 124 */ | |
| 125 const char *msn_user_get_passport(const MsnUser *user); | |
| 126 | |
| 127 /** | |
| 128 * Returns the friendly name for a user. | |
| 129 * | |
| 130 * @param user The user. | |
| 131 * | |
| 132 * @return The friendly name. | |
| 133 */ | |
| 134 const char *msn_user_get_name(const MsnUser *user); | |
| 135 | |
| 136 /** | |
| 137 * Returns the group ID for a user. | |
| 138 * | |
| 139 * @param user The user. | |
| 140 * | |
| 141 * @return The group ID. | |
| 142 */ | |
| 143 int msn_user_get_group_id(const MsnUser *user); | |
| 144 | |
| 145 /** | |
|
5316
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
146 * Sets the client information for a user. |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
147 * |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
148 * @param user The user. |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
149 * @param info The client information. |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
150 */ |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
151 void msn_user_set_client_info(MsnUser *user, GHashTable *info); |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
152 |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
153 /** |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
154 * Returns the client information for a user. |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
155 * |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
156 * @param user The user. |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
157 * |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
158 * @return The client information. |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
159 */ |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
160 GHashTable *msn_user_get_client_info(const MsnUser *user); |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
161 |
|
d5690ed70085
[gaim-migrate @ 5688]
Christian Hammond <chipx86@chipx86.com>
parents:
5309
diff
changeset
|
162 /** |
| 5309 | 163 * Creates a new MsnUsers structure. |
| 164 * | |
| 165 * @return A new MsnUsers structure. | |
| 166 */ | |
| 167 MsnUsers *msn_users_new(void); | |
| 168 | |
| 169 /** | |
| 170 * Destroys a users list. | |
| 171 * | |
| 172 * @param users The users list. | |
| 173 */ | |
| 174 void msn_users_destroy(MsnUsers *users); | |
| 175 | |
| 176 /** | |
| 177 * Adds a user to a users list. | |
| 178 * | |
| 179 * @param users The users list. | |
| 180 * @param user The user. | |
| 181 */ | |
| 182 void msn_users_add(MsnUsers *users, MsnUser *user); | |
| 183 | |
| 184 /** | |
| 185 * Removes a user from a users list. | |
| 186 * | |
| 187 * @param users The users list. | |
| 188 * @param user The user. | |
| 189 */ | |
| 190 void msn_users_remove(MsnUsers *users, MsnUser *user); | |
| 191 | |
| 192 /** | |
| 193 * Finds a user with the specified passport. | |
| 194 * | |
| 195 * @param users A list of users. | |
| 196 * @param passport The passport. | |
| 197 * | |
| 198 * @return The user if found, or @c NULL otherwise. | |
| 199 */ | |
| 200 MsnUser *msn_users_find_with_passport(MsnUsers *users, const char *passport); | |
| 201 | |
| 202 #endif /* _MSN_USER_H_ */ |
