/* search for online people, print them and update offline list */ static void print_notify_onserver(IRC_SERVER_REC *server, GSList *nicks, GSList **offline, const char *desc) { GSList *tmp; GString *str; g_return_if_fail(server != NULL); g_return_if_fail(offline != NULL); g_return_if_fail(desc != NULL); str = g_string_new(NULL); for (tmp = nicks; tmp != NULL; tmp = tmp->next) { char *nick = tmp->data; if (!notifylist_ison_server(server, nick)) continue; g_string_sprintfa(str, "%s, ", nick); *offline = g_slist_remove(*offline, nick); } if (str->len > 0) { g_string_truncate(str, str->len-2); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_NOTIFY_ONLINE, desc, str->str); } g_string_free(str, TRUE); }
static PyObject *PyIrcServer_notifylist_ison(PyIrcServer *self, PyObject *args, PyObject *kwds) { static char *kwlist[] = {"nick", NULL}; char *nick = ""; RET_NULL_IF_INVALID(self->data); if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist, &nick)) return NULL; return PyBool_FromLong(notifylist_ison_server(self->data, nick)); }
IRC_SERVER_REC *notifylist_ison(const char *nick, const char *serverlist) { GSList *tmp; g_return_val_if_fail(nick != NULL, FALSE); g_return_val_if_fail(serverlist != NULL, FALSE); if (*serverlist != '\0') return notifylist_ison_serverlist(nick, serverlist); /* any server.. */ for (tmp = servers; tmp != NULL; tmp = tmp->next) { if (notifylist_ison_server(tmp->data, nick)) return tmp->data; } return NULL; }
static IRC_SERVER_REC *notifylist_ison_serverlist(const char *nick, const char *taglist) { IRC_SERVER_REC *server; char **list, **tmp; list = g_strsplit(taglist, " ", -1); server = NULL; for (tmp = list; *tmp != NULL; tmp++) { server = (IRC_SERVER_REC *) server_find_ircnet(*tmp); if (server != NULL && notifylist_ison_server(server, nick)) break; } g_strfreev(list); return tmp == NULL ? NULL : server; }
static IRC_SERVER_REC *notifylist_ison_serverlist(const char *nick, const char *taglist) { IRC_SERVER_REC *server; char **list, **tmp; g_return_val_if_fail(nick != NULL, NULL); g_return_val_if_fail(taglist != NULL, NULL); list = g_strsplit(taglist, " ", -1); server = NULL; for (tmp = list; *tmp != NULL; tmp++) { server = (IRC_SERVER_REC *) server_find_chatnet(*tmp); if (IS_IRC_SERVER(server) && notifylist_ison_server(server, nick)) break; } g_strfreev(list); return tmp == NULL ? NULL : server; }