void Syscon_Print(const char *msg) { if (input_on) { set_raw(false); } printf("%s", msg); fflush(stdout); if (input_on) { set_raw(true); } }
void SYS_ShowError(const char *text) { if (input_on) { set_raw(false); } printf("Error: %s", text); fflush(stdout); if (input_on) { set_raw(true); } }
void unserialize(SerializeFormat format, Extensible* container, const std::string& value) override { if (value == "1") set_raw(container, this); else unset_raw(container); }
void set(Extensible* container, bool value) { if (value) set_raw(container, this); else unset_raw(container); }
void set(Extensible* item, ssl_cert* value) { value->refcount_inc(); ssl_cert* old = static_cast<ssl_cert*>(set_raw(item, value)); if (old && old->refcount_dec()) delete old; }
void unserialize(SerializeFormat format, Extensible* container, const std::string& value) { if (format == FORMAT_NETWORK) return; callerid_data* dat = new callerid_data; irc::commasepstream s(value); std::string tok; if (s.GetToken(tok)) dat->lastnotify = ConvToInt(tok); while (s.GetToken(tok)) { User *u = ServerInstance->FindNick(tok); if ((u) && (u->registered == REG_ALL) && (!u->quitting)) { if (dat->accepting.insert(u).second) { callerid_data* other = this->get(u, true); other->wholistsme.push_back(dat); } } } void* old = set_raw(container, dat); if (old) this->free(old); }
void Syscon_Cleanup() { con_redirectOutput(NULL); if (input_on) { set_raw(false); } }
bool Syscon_Init() { input_on = true; init_term(); set_raw(false); con_redirectOutput(Syscon_Print); return true; }
callerid_data* get(User* user, bool create) { callerid_data* dat = static_cast<callerid_data*>(get_raw(user)); if (create && !dat) { dat = new callerid_data; set_raw(user, dat); } return dat; }
ExtData* get(Extensible* container, bool create = false) { ExtData* extdata = static_cast<ExtData*>(get_raw(container)); if ((!extdata) && (create)) { extdata = new ExtData; set_raw(container, extdata); } return extdata; }