comparison src/util.c @ 5874:964e4f94fc56

[gaim-migrate @ 6306] Moved gaim_account_find() from util.[ch] to gaim_accounts_find() in account.[ch]. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 14 Jun 2003 23:50:24 +0000
parents 059d95c67cda
children 124ca6f5e895
comparison
equal deleted inserted replaced
5873:a18e88c4dace 5874:964e4f94fc56
534 perror(errmsg); 534 perror(errmsg);
535 } 535 }
536 #endif 536 #endif
537 } 537 }
538 538
539 GaimAccount *gaim_account_find(const char *name, int protocol)
540 {
541 char *who = g_strdup(normalize(name));
542 GList *accts = gaim_accounts_get_all();
543 GaimAccount *account;
544
545 while (accts) {
546 account = (GaimAccount *)accts->data;
547 if (!strcmp(normalize(account->username), who)) {
548 if (protocol != -1) {
549 if (account->protocol == protocol) {
550 g_free(who);
551 return account;
552 }
553 } else {
554 g_free(who);
555 return account;
556 }
557
558 }
559 accts = accts->next;
560 }
561 g_free(who);
562 return NULL;
563 }
564
565 539
566 /* Look for %n, %d, or %t in msg, and replace with the sender's name, date, 540 /* Look for %n, %d, or %t in msg, and replace with the sender's name, date,
567 or time */ 541 or time */
568 char *away_subs(const char *msg, const char *name) 542 char *away_subs(const char *msg, const char *name)
569 { 543 {