/* This file is part of the Project Athena Zephyr Notification System. * It contains source for the ZSetLocation, ZUnsetLocation, and * ZFlushMyLocations functions. * Created by: Robert French * Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology. * For copying and distribution information, see the file Code_t ZSetLocation(exposure) return (Z_SendLocation(LOGIN_CLASS, exposure, ZAUTH, "$sender logged in to $1 on $3 at $2")); return (Z_SendLocation(LOGIN_CLASS, LOGIN_USER_LOGOUT, ZNOAUTH, "$sender logged out of $1 on $3 at $2")); Code_t ZFlushMyLocations() return (Z_SendLocation(LOGIN_CLASS, LOGIN_USER_FLUSH, ZAUTH, "")); static char host[MAXHOSTNAMELEN]; static char *mytty = NULL; Code_t Z_SendLocation(class, opcode, auth, format) ZNotice_t notice, retnotice; #ifndef X_DISPLAY_MISSING short wg_port = ZGetWGPort(); (void) memset((char *)¬ice, 0, sizeof(notice)); notice.z_port = (unsigned short) ((wg_port == -1) ? 0 : wg_port); notice.z_class_inst = ZGetSender(); notice.z_opcode = opcode; notice.z_num_other_fields = 0; notice.z_default_format = format; keep track of what we said before so that we can be consistent when changing location information. This is done mainly for the sake of the WindowGram client. if (gethostname(host, MAXHOSTNAMELEN) < 0) hent = gethostbyname(host); (void) strncpy(host, hent->h_name, sizeof(host)); host[sizeof(host) - 1] = '\0'; #ifndef X_DISPLAY_MISSING if ((display = getenv("DISPLAY")) && *display) { mytty = g_strdup(display); mytty = g_strdup("WinPurple"); p = strchr(ttyp + 1, '/'); mytty = g_strdup((p) ? p + 1 : ttyp); mytty = g_strdup("unknown"); #ifndef X_DISPLAY_MISSING ourtime = time((time_t *)0); bptr[1] = ctime(&ourtime); bptr[1][strlen(bptr[1])-1] = '\0'; if ((retval = ZSendList(¬ice, bptr, 3, auth)) != ZERR_NONE) retval = Z_WaitForNotice (&retnotice, ZCompareUIDPred, ¬ice.z_uid, if (retnotice.z_kind == SERVNAK) { if (!retnotice.z_message_len) { if (purple_strequal(retnotice.z_message, ZSRVACK_NOTSENT)) { if (purple_strequal(retnotice.z_message, ZSRVACK_FAIL)) { if (retnotice.z_kind != SERVACK) { if (!retnotice.z_message_len) { if (!purple_strequal(retnotice.z_message, ZSRVACK_SENT) && !purple_strequal(retnotice.z_message, ZSRVACK_NOTSENT)) {