comparison src/util.c @ 1030:38452403563b

[gaim-migrate @ 1040] updating the buddy list to work better with multiple connections. there are still a bunch of things fucked up with this but i wanted more people to start working on it than just me, especially since i won't be here this weekend. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 27 Oct 2000 07:53:32 +0000
parents d496fe2614a6
children 80a47e3b1bca
comparison
equal deleted inserted replaced
1029:740c6f933fe0 1030:38452403563b
702 gdk_window_set_icon(w, NULL, icon_pm, icon_bm); 702 gdk_window_set_icon(w, NULL, icon_pm, icon_bm);
703 if (mainwindow) gdk_window_set_group(w, mainwindow->window); 703 if (mainwindow) gdk_window_set_group(w, mainwindow->window);
704 #endif 704 #endif
705 } 705 }
706 706
707 struct aim_user *find_user(const char *name) 707 struct aim_user *find_user(const char *name, int protocol)
708 { 708 {
709 char *who = g_strdup(normalize(name)); 709 char *who = g_strdup(normalize(name));
710 GList *usr = aim_users; 710 GList *usr = aim_users;
711 struct aim_user *u; 711 struct aim_user *u;
712 712
713 while(usr) { 713 while(usr) {
714 u = (struct aim_user *)usr->data; 714 u = (struct aim_user *)usr->data;
715 if (!strcmp(normalize(u->username), who)) { 715 if (!strcmp(normalize(u->username), who)) {
716 g_free(who); 716 if (protocol != -1) {
717 return u; 717 if (u->protocol == protocol) {
718 g_free(who);
719 return u;
720 }
721 } else {
722 g_free(who);
723 return u;
724 }
725
718 } 726 }
719 usr = usr->next; 727 usr = usr->next;
720 } 728 }
721 g_free(who); 729 g_free(who);
722 return NULL; 730 return NULL;
1203 1211
1204 void set_first_user (char *name) 1212 void set_first_user (char *name)
1205 { 1213 {
1206 struct aim_user *u; 1214 struct aim_user *u;
1207 1215
1208 u = find_user (name); 1216 u = find_user (name, -1);
1209 1217
1210 if (!u) { /* new user */ 1218 if (!u) { /* new user */
1211 u = g_new0(struct aim_user, 1); 1219 u = g_new0(struct aim_user, 1);
1212 g_snprintf(u->username, sizeof(u->username), "%s", name); 1220 g_snprintf(u->username, sizeof(u->username), "%s", name);
1213 u->protocol = 0 /* PROTO_TOC */; 1221 u->protocol = 0 /* PROTO_TOC */;
1235 1243
1236 if (name != NULL) { /* list of names given */ 1244 if (name != NULL) { /* list of names given */
1237 names = g_strsplit (name, ",", 32); 1245 names = g_strsplit (name, ",", 32);
1238 for (n = names; *n != NULL; n++) { 1246 for (n = names; *n != NULL; n++) {
1239 printf ("user %s...\n", *n); 1247 printf ("user %s...\n", *n);
1240 u = find_user(*n); 1248 u = find_user(*n, -1);
1241 if (u) { /* found a user */ 1249 if (u) { /* found a user */
1242 if (first == NULL) 1250 if (first == NULL)
1243 first = g_strdup (*n); 1251 first = g_strdup (*n);
1244 if (u->options & OPT_USR_REM_PASS) { 1252 if (u->options & OPT_USR_REM_PASS) {
1245 printf ("got user %s\n", *n); 1253 printf ("got user %s\n", *n);