comparison src/protocols/msn/user.h @ 5309:e2e53316a21d

[gaim-migrate @ 5681] Announcing the new MSN prpl! It probably has some bugs, and for the time being, there is no file transfer. That's good though, because the current MSN file transfer is a little broken. I've had many corrupted files. I'll commit new file transfer code when it's written. I want this heavily tested before 0.63! If you use MSN, please talk to people on it. Let me know of any oddities, crashes, bugs, whatever. I'll fix things as I find them. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 06 May 2003 02:06:56 +0000
parents
children d5690ed70085
comparison
equal deleted inserted replaced
5308:6aa785e55d0f 5309:e2e53316a21d
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 {
35 MsnSession *session; /**< The MSN session. */
36
37 char *passport; /**< The passport account. */
38 char *name; /**< The friendly name. */
39
40 int group_id; /**< The group ID. */
41
42 size_t ref_count; /**< The reference count. */
43 };
44
45 /**
46 * A collection of users.
47 */
48 struct _MsnUsers
49 {
50 GList *users; /** The list of users. */
51 };
52
53 /**
54 * Creates a new user structure.
55 *
56 * @param session The MSN session.
57 * @param passport The initial passport.
58 * @param name The initial friendly name.
59 *
60 * @return A new user structure.
61 */
62 MsnUser *msn_user_new(MsnSession *session, const char *passport,
63 const char *name);
64
65 /**
66 * Destroys a user structure.
67 *
68 * @param user The user to destroy.
69 */
70 void msn_user_destroy(MsnUser *user);
71
72 /**
73 * Increments the reference count on a user.
74 *
75 * @param user The user.
76 *
77 * @return @a user
78 */
79 MsnUser *msn_user_ref(MsnUser *user);
80
81 /**
82 * Decrements the reference count on a user.
83 *
84 * This will destroy the structure if the count hits 0.
85 *
86 * @param user The user.
87 *
88 * @return @a user, or @c NULL if the new count is 0.
89 */
90 MsnUser *msn_user_unref(MsnUser *user);
91
92 /**
93 * Sets the passport account for a user.
94 *
95 * @param user The user.
96 * @param passport The passport account.
97 */
98 void msn_user_set_passport(MsnUser *user, const char *passport);
99
100 /**
101 * Sets the friendly name for a user.
102 *
103 * @param user The user.
104 * @param name The friendly name.
105 */
106 void msn_user_set_name(MsnUser *user, const char *name);
107
108 /**
109 * Sets the group ID for a user.
110 *
111 * @param user The user.
112 * @param id The group ID.
113 */
114 void msn_user_set_group_id(MsnUser *user, int id);
115
116 /**
117 * Returns the passport account for a user.
118 *
119 * @param user The user.
120 *
121 * @return The passport account.
122 */
123 const char *msn_user_get_passport(const MsnUser *user);
124
125 /**
126 * Returns the friendly name for a user.
127 *
128 * @param user The user.
129 *
130 * @return The friendly name.
131 */
132 const char *msn_user_get_name(const MsnUser *user);
133
134 /**
135 * Returns the group ID for a user.
136 *
137 * @param user The user.
138 *
139 * @return The group ID.
140 */
141 int msn_user_get_group_id(const MsnUser *user);
142
143 /**
144 * Creates a new MsnUsers structure.
145 *
146 * @return A new MsnUsers structure.
147 */
148 MsnUsers *msn_users_new(void);
149
150 /**
151 * Destroys a users list.
152 *
153 * @param users The users list.
154 */
155 void msn_users_destroy(MsnUsers *users);
156
157 /**
158 * Adds a user to a users list.
159 *
160 * @param users The users list.
161 * @param user The user.
162 */
163 void msn_users_add(MsnUsers *users, MsnUser *user);
164
165 /**
166 * Removes a user from a users list.
167 *
168 * @param users The users list.
169 * @param user The user.
170 */
171 void msn_users_remove(MsnUsers *users, MsnUser *user);
172
173
174 /**
175 * Finds a user with the specified passport.
176 *
177 * @param users A list of users.
178 * @param passport The passport.
179 *
180 * @return The user if found, or @c NULL otherwise.
181 */
182 MsnUser *msn_users_find_with_passport(MsnUsers *users, const char *passport);
183
184 #endif /* _MSN_USER_H_ */