void notify_showlist (struct session *sess) { char outbuf[256]; struct notify *notify; GSList *list = notify_list; struct notify_per_server *servnot; int i = 0; EMIT_SIGNAL (XP_TE_NOTIFYHEAD, sess, NULL, NULL, NULL, NULL, 0); while (list) { i++; notify = (struct notify *) list->data; servnot = notify_find_server_entry (notify, sess->server); if (servnot && servnot->ison) snprintf (outbuf, sizeof (outbuf), _(" %-20s online\n"), notify->name); else snprintf (outbuf, sizeof (outbuf), _(" %-20s offline\n"), notify->name); PrintText (sess, outbuf); list = list->next; } if (i) { sprintf (outbuf, "%d", i); EMIT_SIGNAL (XP_TE_NOTIFYNUMBER, sess, outbuf, NULL, NULL, NULL, 0); } else EMIT_SIGNAL (XP_TE_NOTIFYEMPTY, sess, NULL, NULL, NULL, NULL, 0); }
static struct notify_per_server * notify_find (server *serv, char *nick) { GSList *list = notify_list; struct notify_per_server *servnot; struct notify *notify; while (list) { notify = (struct notify *) list->data; servnot = notify_find_server_entry (notify, serv); if (!servnot) { list = list->next; continue; } if (!serv->p_cmp (notify->name, nick)) return servnot; list = list->next; } return 0; }
void notify_markonline (server *serv, char *word[]) { struct notify *notify; struct notify_per_server *servnot; GSList *list = notify_list; int i, seen; while (list) { notify = (struct notify *) list->data; servnot = notify_find_server_entry (notify, serv); if (!servnot) { list = list->next; continue; } i = 4; seen = FALSE; while (*word[i]) { if (!serv->p_cmp (notify->name, word[i])) { seen = TRUE; notify_announce_online (serv, servnot, notify->name); break; } i++; /* FIXME: word[] is only a 32 element array, limits notify list to about 27 people */ if (i > PDIWORDS - 5) { /*fprintf (stderr, _("*** XCHAT WARNING: notify list too large.\n"));*/ break; } } if (!seen && servnot->ison) { notify_announce_offline (serv, servnot, notify->name, FALSE); } list = list->next; } fe_notify_update (0); }
int xchat_list_next(xchat_plugin *ph, xchat_list *xlist) { if (xlist->next == nullptr) return 0; xlist->pos = xlist->next; xlist->next = xlist->pos->next; /* NOTIFY LIST: Find the entry which matches the context of the plugin when list_get was originally called.*/ if (xlist->type == LIST_NOTIFY) { xlist->notifyps = notify_find_server_entry((notify*)xlist->pos->data, ((session*)xlist->head)->server); if (!xlist->notifyps) return 0; } return 1; }
int notify_isnotify (struct session *sess, char *name) { struct notify *notify; struct notify_per_server *servnot; GSList *list = notify_list; while (list) { notify = (struct notify *) list->data; if (!sess->server->p_cmp (notify->name, name)) { servnot = notify_find_server_entry (notify, sess->server); if (servnot && servnot->ison) return TRUE; } list = list->next; } return FALSE; }