static void watch_toggled(DBusWatch *watch, void *data) { if (dbus_watch_get_enabled(watch)) add_watch(watch, data); else remove_watch(watch, data); }
static void toggle_watch(DBusWatch *w, void *data) { printf(" WATCH: toggle dbus watch watch=%p\n", w); if (dbus_watch_get_enabled(w)) add_watch(w, data); else remove_watch(w, data); }
static void toggle_watch(DBusWatch *w, void *data) { show_debug(__FILE__,__FUNCTION__,__LINE__,"toggling dbus watch watch=%p\n", w); if (dbus_watch_get_enabled(w)) add_watch(w, data); else remove_watch(w, data); }
static void watch_toggled(DBusWatch *watch, void *data) { /* Because we just exit on OOM, enable/disable is * no different from add/remove */ if (dbus_watch_get_enabled(watch)) add_watch(watch, data); else remove_watch(watch, data); }
static void cleanup_inotify(gpointer user_data) { struct connman_inotify *inotify = user_data; g_slist_free(inotify->list); remove_watch(inotify); g_free(inotify); }
CmdResult Handle (const std::vector<std::string> ¶meters, User *user) { if (parameters.empty()) { watchlist* wl = ext.get(user); if (wl) { for (watchlist::iterator q = wl->begin(); q != wl->end(); q++) { if (!q->second.empty()) user->WriteNumeric(604, "%s %s :is online", q->first.c_str(), q->second.c_str()); } } user->WriteNumeric(607, ":End of WATCH list"); } else if (parameters.size() > 0) { for (int x = 0; x < (int)parameters.size(); x++) { const char *nick = parameters[x].c_str(); if (!strcasecmp(nick,"C")) { // watch clear watchlist* wl = ext.get(user); if (wl) { for (watchlist::iterator i = wl->begin(); i != wl->end(); i++) { watchentries::iterator i2 = whos_watching_me->find(i->first); if (i2 != whos_watching_me->end()) { /* People are watching this user, am i one of them? */ std::deque<User*>::iterator n = std::find(i2->second.begin(), i2->second.end(), user); if (n != i2->second.end()) /* I'm no longer watching you... */ i2->second.erase(n); if (i2->second.empty()) /* nobody else is, either. */ whos_watching_me->erase(i2); } } ext.unset(user); } } else if (!strcasecmp(nick,"L")) { watchlist* wl = ext.get(user); if (wl) { for (watchlist::iterator q = wl->begin(); q != wl->end(); q++) { if (!q->second.empty()) { user->WriteNumeric(604, "%s %s :is online", q->first.c_str(), q->second.c_str()); User *targ = ServerInstance->FindNick(q->first.c_str()); if (targ->IsAway()) { user->WriteNumeric(609, "%s %s %s %lu :is away", targ->nick.c_str(), targ->ident.c_str(), targ->dhost.c_str(), (unsigned long) targ->awaytime); } } else user->WriteNumeric(605, "%s * * 0 :is offline", q->first.c_str()); } } user->WriteNumeric(607, ":End of WATCH list"); } else if (!strcasecmp(nick,"S")) { watchlist* wl = ext.get(user); int you_have = 0; int youre_on = 0; std::string list; if (wl) { for (watchlist::iterator q = wl->begin(); q != wl->end(); q++) list.append(q->first.c_str()).append(" "); you_have = wl->size(); } watchentries::iterator i2 = whos_watching_me->find(user->nick.c_str()); if (i2 != whos_watching_me->end()) youre_on = i2->second.size(); user->WriteNumeric(603, ":You have %d and are on %d WATCH entries", you_have, youre_on); user->WriteNumeric(606, ":%s", list.c_str()); user->WriteNumeric(607, ":End of WATCH S"); } else if (nick[0] == '-') { nick++; remove_watch(user, nick); } else if (nick[0] == '+') { nick++; add_watch(user, nick); } } } return CMD_SUCCESS; }