comparison src/util.c @ 4491:3196d9044a45

[gaim-migrate @ 4766] aim_user is dead. long live gaim_account. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 31 Jan 2003 13:03:47 +0000
parents 62c1e5e656d0
children 42d53c416bb9
comparison
equal deleted inserted replaced
4490:70b892694e0b 4491:3196d9044a45
506 perror(errmsg); 506 perror(errmsg);
507 } 507 }
508 #endif 508 #endif
509 } 509 }
510 510
511 struct aim_user *find_user(const char *name, int protocol) 511 struct gaim_account *gaim_account_find(const char *name, int protocol)
512 { 512 {
513 char *who = g_strdup(normalize(name)); 513 char *who = g_strdup(normalize(name));
514 GSList *usr = aim_users; 514 GSList *accts = gaim_accounts;
515 struct aim_user *u; 515 struct gaim_account *account;
516 516
517 while (usr) { 517 while (accts) {
518 u = (struct aim_user *)usr->data; 518 account = (struct gaim_account *)accts->data;
519 if (!strcmp(normalize(u->username), who)) { 519 if (!strcmp(normalize(account->username), who)) {
520 if (protocol != -1) { 520 if (protocol != -1) {
521 if (u->protocol == protocol) { 521 if (account->protocol == protocol) {
522 g_free(who); 522 g_free(who);
523 return u; 523 return account;
524 } 524 }
525 } else { 525 } else {
526 g_free(who); 526 g_free(who);
527 return u; 527 return account;
528 } 528 }
529 529
530 } 530 }
531 usr = usr->next; 531 accts = accts->next;
532 } 532 }
533 g_free(who); 533 g_free(who);
534 return NULL; 534 return NULL;
535 } 535 }
536 536
997 what++; 997 what++;
998 } 998 }
999 what = g_strdup(str->str); 999 what = g_strdup(str->str);
1000 g_string_free(str, TRUE); 1000 g_string_free(str, TRUE);
1001 } 1001 }
1002 1002
1003 c = gaim_conversation_new(GAIM_CONV_IM, gc->user, who); 1003 c = gaim_conversation_new(GAIM_CONV_IM, gc->account, who);
1004 g_free(who); 1004 g_free(who);
1005 1005
1006 if (what) { 1006 if (what) {
1007 struct gaim_gtk_conversation *gtkconv = GAIM_GTK_CONVERSATION(c); 1007 struct gaim_gtk_conversation *gtkconv = GAIM_GTK_CONVERSATION(c);
1008 1008
1011 } 1011 }
1012 } else if (!g_strncasecmp(uri, "aim:addbuddy?", strlen("aim:addbuddy?"))) { 1012 } else if (!g_strncasecmp(uri, "aim:addbuddy?", strlen("aim:addbuddy?"))) {
1013 char *who, *group; 1013 char *who, *group;
1014 uri = uri + strlen("aim:addbuddy?"); 1014 uri = uri + strlen("aim:addbuddy?");
1015 /* spaces are encoded as +'s */ 1015 /* spaces are encoded as +'s */
1016 1016
1017 if (!(who = strstr(uri, "screenname="))) { 1017 if (!(who = strstr(uri, "screenname="))) {
1018 return _("No screenname given."); 1018 return _("No screenname given.");
1019 } 1019 }
1020 who = who + strlen("screenname="); 1020 who = who + strlen("screenname=");
1021 str = g_string_new(NULL); 1021 str = g_string_new(NULL);