Changeset f25812b for functions.c
- Timestamp:
- Mar 24, 2010, 4:24:38 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 125fd21
- Parents:
- 59ab8dd
- git-author:
- Alejandro R. Sedeño <asedeno@mit.edu> (03/23/10 01:11:31)
- git-committer:
- Alejandro R. Sedeño <asedeno@mit.edu> (03/24/10 16:24:38)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
functions.c
r5934b87 rf25812b 3410 3410 int i, j; 3411 3411 owl_list anyone; 3412 owl_message *m;3413 3412 owl_zbuddylist *zbl; 3413 GList **zaldlist; 3414 GList *zaldptr; 3415 ZAsyncLocateData_t *zald; 3414 3416 const char *user; 3415 ZLocations_t location[200];3416 int numlocs, ret;3417 3417 3418 3418 if (!owl_global_is_havezephyr(&g)) return; 3419 3420 zbl=owl_global_get_zephyr_buddylist(&g); 3419 owl_global_set_pseudologin_notify(&g, notify); 3420 zbl = owl_global_get_zephyr_buddylist(&g); 3421 zaldlist = owl_global_get_zaldlist(&g); 3422 3423 /* Clear the existing ZALDs first. */ 3424 zaldptr = g_list_first(*zaldlist); 3425 while (zaldptr) { 3426 ZFreeALD(zaldptr->data); 3427 owl_free(zaldptr->data); 3428 zaldptr = g_list_next(zaldptr); 3429 } 3430 g_list_free(*zaldlist); 3431 *zaldlist = NULL; 3421 3432 3422 3433 owl_list_create(&anyone); 3423 ret=owl_zephyr_get_anyone_list(&anyone, NULL); 3424 3425 j=owl_list_get_size(&anyone); 3426 for (i=0; i<j; i++) { 3427 user=owl_list_get_element(&anyone, i); 3428 ret=ZLocateUser(zstr(user), &numlocs, ZAUTH); 3429 if (ret!=ZERR_NONE) { 3430 owl_function_error("Error getting location for %s", user); 3431 continue; 3432 } 3433 numlocs=200; 3434 ret=ZGetLocations(location, &numlocs); 3435 if (ret==0) { 3436 if ((numlocs>0) && !owl_zbuddylist_contains_user(zbl, user)) { 3437 /* Send a PSEUDO LOGIN! */ 3438 if (notify) { 3439 m=owl_malloc(sizeof(owl_message)); 3440 owl_message_create_pseudo_zlogin(m, 0, user, location[0].host, location[0].time, location[0].tty); 3441 owl_global_messagequeue_addmsg(&g, m); 3442 } 3443 owl_zbuddylist_adduser(zbl, user); 3444 owl_function_debugmsg("owl_function_zephyr_buddy_check: login for %s ", user); 3445 } else if ((numlocs==0) && owl_zbuddylist_contains_user(zbl, user)) { 3446 /* I don't think this ever happens (if there are 0 locations we should get an error from 3447 * ZGetLocations) 3448 */ 3449 owl_function_error("owl_function_zephyr_buddy_check: exceptional case logout for %s ",user); 3450 } 3451 } else if ((ret==ZERR_NOLOCATIONS) && owl_zbuddylist_contains_user(zbl, user)) { 3452 /* Send a PSEUDO LOGOUT! */ 3453 if (notify) { 3454 m=owl_malloc(sizeof(owl_message)); 3455 owl_message_create_pseudo_zlogin(m, 1, user, "", "", ""); 3456 owl_global_messagequeue_addmsg(&g, m); 3457 } 3458 owl_zbuddylist_deluser(zbl, user); 3459 owl_function_debugmsg("owl_function_zephyr_buddy_check: logout for %s ",user); 3434 owl_zephyr_get_anyone_list(&anyone, NULL); 3435 j = owl_list_get_size(&anyone); 3436 for (i = 0; i < j; i++) { 3437 user = owl_list_get_element(&anyone, i); 3438 zald = owl_malloc(sizeof(ZAsyncLocateData_t)); 3439 if (ZRequestLocations(zstr(user), zald, UNACKED, ZAUTH) == ZERR_NONE) { 3440 *zaldlist = g_list_append(*zaldlist, zald); 3441 } else { 3442 owl_free(zald); 3460 3443 } 3461 3444 }
Note: See TracChangeset
for help on using the changeset viewer.