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