|
5730
|
1 /**
|
|
|
2 * @file profile.h Trepia profile API
|
|
|
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 #include "profile.h"
|
|
|
23
|
|
|
24 TrepiaProfile *
|
|
|
25 trepia_profile_new(void)
|
|
|
26 {
|
|
|
27 return g_new0(TrepiaProfile, 1);
|
|
|
28 }
|
|
|
29
|
|
|
30 void
|
|
|
31 trepia_profile_destroy(TrepiaProfile *profile)
|
|
|
32 {
|
|
|
33 if (profile->location != NULL) g_free(profile->location);
|
|
|
34 if (profile->login != NULL) g_free(profile->login);
|
|
|
35 if (profile->first_name != NULL) g_free(profile->first_name);
|
|
|
36 if (profile->last_name != NULL) g_free(profile->last_name);
|
|
|
37 if (profile->profile != NULL) g_free(profile->profile);
|
|
|
38 if (profile->email != NULL) g_free(profile->email);
|
|
|
39 if (profile->aim != NULL) g_free(profile->aim);
|
|
|
40 if (profile->homepage != NULL) g_free(profile->homepage);
|
|
|
41 if (profile->country != NULL) g_free(profile->country);
|
|
|
42 if (profile->state != NULL) g_free(profile->state);
|
|
|
43 if (profile->city != NULL) g_free(profile->city);
|
|
|
44 if (profile->languages != NULL) g_free(profile->languages);
|
|
|
45 if (profile->school != NULL) g_free(profile->school);
|
|
|
46 if (profile->company != NULL) g_free(profile->company);
|
|
|
47
|
|
|
48 g_free(profile);
|
|
|
49 }
|
|
|
50
|
|
|
51 void
|
|
|
52 trepia_profile_set_id(TrepiaProfile *profile, int value)
|
|
|
53 {
|
|
|
54 g_return_if_fail(profile != NULL);
|
|
|
55
|
|
|
56 profile->id = value;
|
|
|
57 }
|
|
|
58
|
|
|
59 void
|
|
|
60 trepia_profile_set_location(TrepiaProfile *profile, const char *value)
|
|
|
61 {
|
|
|
62 g_return_if_fail(profile != NULL);
|
|
|
63
|
|
|
64 if (profile->location != NULL)
|
|
|
65 g_free(profile->location);
|
|
|
66
|
|
|
67 profile->location = (value == NULL ? NULL : g_strdup(value));
|
|
|
68 }
|
|
|
69
|
|
|
70 void
|
|
|
71 trepia_profile_set_login_time(TrepiaProfile *profile, time_t value)
|
|
|
72 {
|
|
|
73 g_return_if_fail(profile != NULL);
|
|
|
74
|
|
|
75 profile->login_time = value;
|
|
|
76 }
|
|
|
77
|
|
|
78 void
|
|
|
79 trepia_profile_set_login(TrepiaProfile *profile, const char *value)
|
|
|
80 {
|
|
|
81 g_return_if_fail(profile != NULL);
|
|
|
82
|
|
|
83 if (profile->login != NULL)
|
|
|
84 g_free(profile->login);
|
|
|
85
|
|
|
86 profile->login = (value == NULL ? NULL : g_strdup(value));
|
|
|
87 }
|
|
|
88
|
|
|
89 void
|
|
|
90 trepia_profile_set_age(TrepiaProfile *profile, int value)
|
|
|
91 {
|
|
|
92 g_return_if_fail(profile != NULL);
|
|
|
93
|
|
|
94 profile->age = value;
|
|
|
95 }
|
|
|
96
|
|
|
97
|
|
|
98 void
|
|
|
99 trepia_profile_set_sex(TrepiaProfile *profile, char value)
|
|
|
100 {
|
|
|
101 g_return_if_fail(profile != NULL);
|
|
|
102
|
|
|
103 profile->sex = value;
|
|
|
104 }
|
|
|
105
|
|
|
106 void
|
|
|
107 trepia_profile_set_first_name(TrepiaProfile *profile, const char *value)
|
|
|
108 {
|
|
|
109 g_return_if_fail(profile != NULL);
|
|
|
110
|
|
|
111 if (profile->first_name != NULL)
|
|
|
112 g_free(profile->first_name);
|
|
|
113
|
|
|
114 profile->first_name = (value == NULL ? NULL : g_strdup(value));
|
|
|
115 }
|
|
|
116
|
|
|
117 void
|
|
|
118 trepia_profile_set_last_name(TrepiaProfile *profile, const char *value)
|
|
|
119 {
|
|
|
120 g_return_if_fail(profile != NULL);
|
|
|
121
|
|
|
122 if (profile->last_name != NULL)
|
|
|
123 g_free(profile->last_name);
|
|
|
124
|
|
|
125 profile->last_name = (value == NULL ? NULL : g_strdup(value));
|
|
|
126 }
|
|
|
127
|
|
|
128 void
|
|
|
129 trepia_profile_set_profile(TrepiaProfile *profile, const char *value)
|
|
|
130 {
|
|
|
131 g_return_if_fail(profile != NULL);
|
|
|
132
|
|
|
133 if (profile->profile != NULL)
|
|
|
134 g_free(profile->profile);
|
|
|
135
|
|
|
136 profile->profile = (value == NULL ? NULL : g_strdup(value));
|
|
|
137 }
|
|
|
138
|
|
|
139 void
|
|
|
140 trepia_profile_set_email(TrepiaProfile *profile, const char *value)
|
|
|
141 {
|
|
|
142 g_return_if_fail(profile != NULL);
|
|
|
143
|
|
|
144 if (profile->email != NULL)
|
|
|
145 g_free(profile->email);
|
|
|
146
|
|
|
147 profile->email = (value == NULL ? NULL : g_strdup(value));
|
|
|
148 }
|
|
|
149
|
|
|
150 void
|
|
|
151 trepia_profile_set_icq(TrepiaProfile *profile, int value)
|
|
|
152 {
|
|
|
153 g_return_if_fail(profile != NULL);
|
|
|
154
|
|
|
155 profile->icq = value;
|
|
|
156 }
|
|
|
157
|
|
|
158 void
|
|
|
159 trepia_profile_set_aim(TrepiaProfile *profile, const char *value)
|
|
|
160 {
|
|
|
161 g_return_if_fail(profile != NULL);
|
|
|
162
|
|
|
163 if (profile->aim != NULL)
|
|
|
164 g_free(profile->aim);
|
|
|
165
|
|
|
166 profile->aim = (value == NULL ? NULL : g_strdup(value));
|
|
|
167 }
|
|
|
168
|
|
|
169 void
|
|
|
170 trepia_profile_set_msn(TrepiaProfile *profile, const char *value)
|
|
|
171 {
|
|
|
172 g_return_if_fail(profile != NULL);
|
|
|
173
|
|
|
174 if (profile->msn != NULL)
|
|
|
175 g_free(profile->msn);
|
|
|
176
|
|
|
177 profile->msn = (value == NULL ? NULL : g_strdup(value));
|
|
|
178 }
|
|
|
179
|
|
|
180 void
|
|
|
181 trepia_profile_set_yahoo(TrepiaProfile *profile, const char *value)
|
|
|
182 {
|
|
|
183 g_return_if_fail(profile != NULL);
|
|
|
184
|
|
|
185 if (profile->yahoo != NULL)
|
|
|
186 g_free(profile->yahoo);
|
|
|
187
|
|
|
188 profile->yahoo = (value == NULL ? NULL : g_strdup(value));
|
|
|
189 }
|
|
|
190
|
|
|
191 void
|
|
|
192 trepia_profile_set_homepage(TrepiaProfile *profile, const char *value)
|
|
|
193 {
|
|
|
194 g_return_if_fail(profile != NULL);
|
|
|
195
|
|
|
196 if (profile->homepage != NULL)
|
|
|
197 g_free(profile->homepage);
|
|
|
198
|
|
|
199 profile->homepage = (value == NULL ? NULL : g_strdup(value));
|
|
|
200 }
|
|
|
201
|
|
|
202 void
|
|
|
203 trepia_profile_set_country(TrepiaProfile *profile, const char *value)
|
|
|
204 {
|
|
|
205 g_return_if_fail(profile != NULL);
|
|
|
206
|
|
|
207 if (profile->country != NULL)
|
|
|
208 g_free(profile->country);
|
|
|
209
|
|
|
210 profile->country = (value == NULL ? NULL : g_strdup(value));
|
|
|
211 }
|
|
|
212
|
|
|
213 void
|
|
|
214 trepia_profile_set_state(TrepiaProfile *profile, const char *value)
|
|
|
215 {
|
|
|
216 g_return_if_fail(profile != NULL);
|
|
|
217
|
|
|
218 if (profile->state != NULL)
|
|
|
219 g_free(profile->state);
|
|
|
220
|
|
|
221 profile->state = (value == NULL ? NULL : g_strdup(value));
|
|
|
222 }
|
|
|
223
|
|
|
224 void
|
|
|
225 trepia_profile_set_city(TrepiaProfile *profile, const char *value)
|
|
|
226 {
|
|
|
227 g_return_if_fail(profile != NULL);
|
|
|
228
|
|
|
229 if (profile->city != NULL)
|
|
|
230 g_free(profile->city);
|
|
|
231
|
|
|
232 profile->city = (value == NULL ? NULL : g_strdup(value));
|
|
|
233 }
|
|
|
234
|
|
|
235 void
|
|
|
236 trepia_profile_set_languages(TrepiaProfile *profile, const char *value)
|
|
|
237 {
|
|
|
238 g_return_if_fail(profile != NULL);
|
|
|
239
|
|
|
240 if (profile->languages != NULL)
|
|
|
241 g_free(profile->languages);
|
|
|
242
|
|
|
243 profile->languages = (value == NULL ? NULL : g_strdup(value));
|
|
|
244 }
|
|
|
245
|
|
|
246 void
|
|
|
247 trepia_profile_set_school(TrepiaProfile *profile, const char *value)
|
|
|
248 {
|
|
|
249 g_return_if_fail(profile != NULL);
|
|
|
250
|
|
|
251 if (profile->school != NULL)
|
|
|
252 g_free(profile->school);
|
|
|
253
|
|
|
254 profile->school = (value == NULL ? NULL : g_strdup(value));
|
|
|
255 }
|
|
|
256
|
|
|
257 void
|
|
|
258 trepia_profile_set_company(TrepiaProfile *profile, const char *value)
|
|
|
259 {
|
|
|
260 g_return_if_fail(profile != NULL);
|
|
|
261
|
|
|
262 if (profile->company != NULL)
|
|
|
263 g_free(profile->company);
|
|
|
264
|
|
|
265 profile->company = (value == NULL ? NULL : g_strdup(value));
|
|
|
266 }
|
|
|
267
|
|
|
268 int
|
|
|
269 trepia_profile_get_id(const TrepiaProfile *profile)
|
|
|
270 {
|
|
|
271 g_return_val_if_fail(profile != NULL, 0);
|
|
|
272
|
|
|
273 return profile->id;
|
|
|
274 }
|
|
|
275
|
|
|
276 const char *
|
|
|
277 trepia_profile_get_location(const TrepiaProfile *profile)
|
|
|
278 {
|
|
|
279 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
280
|
|
|
281 return profile->location;
|
|
|
282 }
|
|
|
283
|
|
|
284 time_t
|
|
|
285 trepia_profile_get_login_time(const TrepiaProfile *profile)
|
|
|
286 {
|
|
|
287 g_return_val_if_fail(profile != NULL, 0);
|
|
|
288
|
|
|
289 return profile->login_time;
|
|
|
290 }
|
|
|
291
|
|
|
292 const char *
|
|
|
293 trepia_profile_get_login(const TrepiaProfile *profile)
|
|
|
294 {
|
|
|
295 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
296
|
|
|
297 return profile->login;
|
|
|
298 }
|
|
|
299
|
|
|
300 int
|
|
|
301 trepia_profile_get_age(const TrepiaProfile *profile)
|
|
|
302 {
|
|
|
303 g_return_val_if_fail(profile != NULL, 0);
|
|
|
304
|
|
|
305 return profile->age;
|
|
|
306 }
|
|
|
307
|
|
|
308 char
|
|
|
309 trepia_profile_get_sex(const TrepiaProfile *profile)
|
|
|
310 {
|
|
|
311 g_return_val_if_fail(profile != NULL, '?');
|
|
|
312
|
|
|
313 return profile->sex;
|
|
|
314 }
|
|
|
315
|
|
|
316 const char *
|
|
|
317 trepia_profile_get_first_name(const TrepiaProfile *profile)
|
|
|
318 {
|
|
|
319 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
320
|
|
|
321 return profile->first_name;
|
|
|
322 }
|
|
|
323
|
|
|
324 const char *
|
|
|
325 trepia_profile_get_last_name(const TrepiaProfile *profile)
|
|
|
326 {
|
|
|
327 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
328
|
|
|
329 return profile->last_name;
|
|
|
330 }
|
|
|
331
|
|
|
332 const char *
|
|
|
333 trepia_profile_get_profile(const TrepiaProfile *profile)
|
|
|
334 {
|
|
|
335 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
336
|
|
|
337 return profile->profile;
|
|
|
338 }
|
|
|
339
|
|
|
340 const char *
|
|
|
341 trepia_profile_get_email(const TrepiaProfile *profile)
|
|
|
342 {
|
|
|
343 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
344
|
|
|
345 return profile->email;
|
|
|
346 }
|
|
|
347
|
|
|
348 int
|
|
|
349 trepia_profile_get_icq(const TrepiaProfile *profile)
|
|
|
350 {
|
|
|
351 g_return_val_if_fail(profile != NULL, 0);
|
|
|
352
|
|
|
353 return profile->icq;
|
|
|
354 }
|
|
|
355
|
|
|
356 const char *
|
|
|
357 trepia_profile_get_aim(const TrepiaProfile *profile)
|
|
|
358 {
|
|
|
359 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
360
|
|
|
361 return profile->aim;
|
|
|
362 }
|
|
|
363
|
|
|
364 const char *
|
|
|
365 trepia_profile_get_msn(const TrepiaProfile *profile)
|
|
|
366 {
|
|
|
367 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
368
|
|
|
369 return profile->msn;
|
|
|
370 }
|
|
|
371
|
|
|
372 const char *
|
|
|
373 trepia_profile_get_yahoo(const TrepiaProfile *profile)
|
|
|
374 {
|
|
|
375 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
376
|
|
|
377 return profile->yahoo;
|
|
|
378 }
|
|
|
379
|
|
|
380 const char *
|
|
|
381 trepia_profile_get_homepage(const TrepiaProfile *profile)
|
|
|
382 {
|
|
|
383 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
384
|
|
|
385 return profile->homepage;
|
|
|
386 }
|
|
|
387
|
|
|
388 const char *
|
|
|
389 trepia_profile_get_country(const TrepiaProfile *profile)
|
|
|
390 {
|
|
|
391 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
392
|
|
|
393 return profile->country;
|
|
|
394 }
|
|
|
395
|
|
|
396 const char *
|
|
|
397 trepia_profile_get_state(const TrepiaProfile *profile)
|
|
|
398 {
|
|
|
399 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
400
|
|
|
401 return profile->state;
|
|
|
402 }
|
|
|
403
|
|
|
404 const char *
|
|
|
405 trepia_profile_get_city(const TrepiaProfile *profile)
|
|
|
406 {
|
|
|
407 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
408
|
|
|
409 return profile->city;
|
|
|
410 }
|
|
|
411
|
|
|
412 const char *
|
|
|
413 trepia_profile_get_languages(const TrepiaProfile *profile)
|
|
|
414 {
|
|
|
415 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
416
|
|
|
417 return profile->languages;
|
|
|
418 }
|
|
|
419
|
|
|
420 const char *
|
|
|
421 trepia_profile_get_school(const TrepiaProfile *profile)
|
|
|
422 {
|
|
|
423 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
424
|
|
|
425 return profile->school;
|
|
|
426 }
|
|
|
427
|
|
|
428 const char *
|
|
|
429 trepia_profile_get_company(const TrepiaProfile *profile)
|
|
|
430 {
|
|
|
431 g_return_val_if_fail(profile != NULL, NULL);
|
|
|
432
|
|
|
433 return profile->company;
|
|
|
434 }
|
|
|
435
|