Mercurial > pidgin.yaz
comparison src/util.c @ 2042:d5033540df18
[gaim-migrate @ 2052]
i finally made up my mind about this. if you're specifying --login then it shouldn't reorder them, because you might not want them to be in a different order.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 16 Jun 2001 19:53:23 +0000 |
parents | 859e9c2c5813 |
children | 1b8f4b90bf09 |
comparison
equal
deleted
inserted
replaced
2041:241ffe9ee605 | 2042:d5033540df18 |
---|---|
1177 break; | 1177 break; |
1178 } | 1178 } |
1179 } | 1179 } |
1180 | 1180 |
1181 | 1181 |
1182 void set_first_user(char *name) | |
1183 { | |
1184 struct aim_user *u; | |
1185 | |
1186 u = find_user(name, -1); | |
1187 | |
1188 if (!u) { /* new user */ | |
1189 u = g_new0(struct aim_user, 1); | |
1190 g_snprintf(u->username, sizeof(u->username), "%s", name); | |
1191 u->protocol = DEFAULT_PROTO; | |
1192 aim_users = g_list_prepend(aim_users, u); | |
1193 } else { /* user already exists */ | |
1194 aim_users = g_list_remove(aim_users, u); | |
1195 aim_users = g_list_prepend(aim_users, u); | |
1196 } | |
1197 save_prefs(); | |
1198 } | |
1199 | |
1200 | |
1201 /* <name> is a comma-separated list of names, or NULL | 1182 /* <name> is a comma-separated list of names, or NULL |
1202 if NULL and there is at least one user defined in .gaimrc, try to login. | 1183 if NULL and there is at least one user defined in .gaimrc, try to login. |
1203 if not NULL, parse <name> into separate strings, look up each one in | 1184 if not NULL, parse <name> into separate strings, look up each one in |
1204 .gaimrc and, if it's there, try to login. | 1185 .gaimrc and, if it's there, try to login. |
1205 returns: 0 if successful | 1186 returns: 0 if successful |
1206 -1 if no user was found that had a saved password | 1187 -1 if no user was found that had a saved password |
1207 */ | 1188 */ |
1208 int do_auto_login(char *name) | 1189 int do_auto_login(char *name) |
1209 { | 1190 { |
1210 struct aim_user *u; | 1191 struct aim_user *u; |
1211 char **names, **n, *first = NULL; | 1192 char **names, **n; |
1212 int retval = -1; | 1193 int retval = -1; |
1213 | 1194 |
1214 if (name !=NULL) { /* list of names given */ | 1195 if (name !=NULL) { /* list of names given */ |
1215 names = g_strsplit(name, ",", 32); | 1196 names = g_strsplit(name, ",", 32); |
1216 for (n = names; *n != NULL; n++) { | 1197 for (n = names; *n != NULL; n++) { |
1217 u = find_user(*n, -1); | 1198 u = find_user(*n, -1); |
1218 if (u) { /* found a user */ | 1199 if (u) { /* found a user */ |
1219 if (first == NULL) | |
1220 first = g_strdup(*n); | |
1221 if (u->options & OPT_USR_REM_PASS) { | 1200 if (u->options & OPT_USR_REM_PASS) { |
1222 retval = 0; | 1201 retval = 0; |
1223 serv_login(u); | 1202 serv_login(u); |
1224 } | 1203 } |
1225 } | 1204 } |
1226 } | 1205 } |
1227 /* make the first user listed the default */ | |
1228 if (first != NULL) | |
1229 set_first_user(first); | |
1230 g_strfreev(names); | 1206 g_strfreev(names); |
1231 g_free(first); | |
1232 } else { /* no name given, use default */ | 1207 } else { /* no name given, use default */ |
1233 u = (struct aim_user *)aim_users->data; | 1208 u = (struct aim_user *)aim_users->data; |
1234 if (u->options & OPT_USR_REM_PASS) { | 1209 if (u->options & OPT_USR_REM_PASS) { |
1235 retval = 0; | 1210 retval = 0; |
1236 serv_login(u); | 1211 serv_login(u); |