- Timestamp:
- Mar 24, 2010, 4:24:38 PM (14 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
-
zephyr.c
rc230bc1 rf25812b 1299 1299 } 1300 1300 1301 #ifdef HAVE_LIBZEPHYR 1302 void owl_zephyr_process_pseudologin(ZNotice_t *n) 1303 { 1304 owl_message *m; 1305 owl_zbuddylist *zbl; 1306 GList **zaldlist; 1307 GList *zaldptr; 1308 ZAsyncLocateData_t *zald = NULL; 1309 ZLocations_t location; 1310 int numlocs, ret, notify; 1311 1312 /* Find a ZALD to match this notice. */ 1313 zaldlist = owl_global_get_zaldlist(&g); 1314 zaldptr = g_list_first(*zaldlist); 1315 while (zaldptr) { 1316 if (ZCompareALDPred(n, zaldptr->data)) { 1317 zald = zaldptr->data; 1318 *zaldlist = g_list_remove(*zaldlist, zaldptr->data); 1319 break; 1320 } 1321 zaldptr = g_list_next(zaldptr); 1322 } 1323 if (zald) { 1324 /* Deal with notice. */ 1325 notify = owl_global_get_pseudologin_notify(&g); 1326 zbl = owl_global_get_zephyr_buddylist(&g); 1327 ret = ZParseLocations(n, zald, &numlocs, NULL); 1328 if (ret == ZERR_NONE) { 1329 if (numlocs > 0 && !owl_zbuddylist_contains_user(zbl, zald->user)) { 1330 if (notify) { 1331 numlocs = 1; 1332 ret = ZGetLocations(&location, &numlocs); 1333 if (ret == ZERR_NONE) { 1334 /* Send a PSEUDO LOGIN! */ 1335 m = owl_malloc(sizeof(owl_message)); 1336 owl_message_create_pseudo_zlogin(m, 0, zald->user, 1337 location.host, 1338 location.time, 1339 location.tty); 1340 owl_global_messagequeue_addmsg(&g, m); 1341 } 1342 owl_zbuddylist_adduser(zbl, zald->user); 1343 owl_function_debugmsg("owl_function_zephyr_buddy_check: login for %s ", zald->user); 1344 } 1345 } else if (numlocs == 0 && owl_zbuddylist_contains_user(zbl, zald->user)) { 1346 /* Send a PSEUDO LOGOUT! */ 1347 if (notify) { 1348 m = owl_malloc(sizeof(owl_message)); 1349 owl_message_create_pseudo_zlogin(m, 1, zald->user, "", "", ""); 1350 owl_global_messagequeue_addmsg(&g, m); 1351 } 1352 owl_zbuddylist_deluser(zbl, zald->user); 1353 owl_function_debugmsg("owl_function_zephyr_buddy_check: logout for %s ", zald->user); 1354 } 1355 } 1356 ZFreeALD(zald); 1357 owl_free(zald); 1358 } 1359 } 1360 #else 1361 void owl_zephyr_process_pseudologin(void *n) 1362 { 1363 } 1364 #endif 1365 1301 1366 /* 1302 1367 * Process zephyrgrams from libzephyr's queue. To prevent starvation, … … 1333 1398 } 1334 1399 1400 /* if it is a LOCATE message, it's for pseudologins. */ 1401 if (strcmp(notice.z_opcode, LOCATE_LOCATE) == 0) { 1402 owl_zephyr_process_pseudologin(¬ice); 1403 ZFreeNotice(¬ice); 1404 continue; 1405 } 1406 1335 1407 /* create the new message */ 1336 1408 m=owl_malloc(sizeof(owl_message));
Note: See TracChangeset
for help on using the changeset viewer.