NmdcHub::~NmdcHub() throw() { TimerManager::getInstance()->removeListener(this); Speaker<NmdcHubListener>::removeListeners(); Lock l(cs); clearUsers(); };
void KDModule::propagateUsers() { groupmap.clear(); emit clearUsers(); QMap< QString, int > lusers; QMapConstIterator< QString, QPair< int, QStringList > > it; QStringList::ConstIterator jt; QMap< QString, int >::Iterator gmapi; for(it = usermap.begin(); it != usermap.end(); ++it) { int uid = it.data().first; if(!uid || (uid >= minshowuid && uid <= maxshowuid)) { lusers[it.key()] = uid; for(jt = it.data().second.begin(); jt != it.data().second.end(); ++jt) if((gmapi = groupmap.find(*jt)) == groupmap.end()) { groupmap[*jt] = 1; lusers['@' + *jt] = -uid; } else (*gmapi)++; } } emit addUsers(lusers); updateOK = true; }
void NmdcHub::disconnect() throw() { state = STATE_CONNECT; socket->disconnect(); { Lock l(cs); clearUsers(); } }
// BufferedSocketListener void NmdcHub::on(BufferedSocketListener::Failed, const string& aLine) throw() { { Lock l(cs); clearUsers(); } if(state == STATE_CONNECTED) state = STATE_CONNECT; Speaker<NmdcHubListener>::fire(NmdcHubListener::Failed(), this, aLine); }
void NetworkServer::disconnect() { if (isConnected()) { clearUsers(); _queuedUser = 0; // Wait for 1 second to try to get everything out _peer->Shutdown(1000); RakNetworkFactory::DestroyRakPeerInterface(_peer); _peer = 0; } }
/* multiline */ void WebcamEngine::raw_250b(const QByteArray &data) { // init data QString strData = codec_iso8859_2->toUnicode(data); // is empty if (strData.isEmpty()) return; QStringList strDataList = strData.split("\n"); /* clear users */ emit clearUsers(); foreach (QString strLine, strDataList) { QStringList strLineList = strLine.split(":"); if (strLineList.size() == 6) { QString strUser = strLineList.at(0); int iCamOnOff = strLineList.at(1).toInt(); // 1 = on; 2 = off QString strChannelsParams = strLineList.at(2); int iSpectators = strLineList.at(3).toInt(); QString strUdget = strLineList.at(4); // udget (012345) int iRank = strLineList.at(5).toInt(); // -500 to 500 // NO_SUCH_USER / Spectators and Rank unknown if ((strLineList.at(3) == "-") && (strLineList.at(5) == "-")) iCamOnOff = 0; // off QStringList lUserChannels; if (!strChannelsParams.isEmpty()) { // 2/0/#Quiz/0,2/0/#Relax/0,2/0/#Scrabble/0,4/0/#scc/0 QStringList lChannelsParams = strChannelsParams.split(","); foreach (QString strChannelParams, lChannelsParams) { QStringList lChannelParams = strChannelParams.split("/"); if (lChannelParams.size() == 4) { int iChannelCategory = lChannelParams.at(0).toInt(); int iUnknown = lChannelParams.at(1).toInt(); // always 0 or -2 QString strChannelName = lChannelParams.at(2); int iCamPubPriv = lChannelParams.at(3).toInt(); // 0 = public; 1 = private Q_UNUSED(iChannelCategory); Q_UNUSED(iUnknown); Q_UNUSED(iCamPubPriv); lUserChannels.append(strChannelName); } }
void NmdcHub::refreshUserList(bool unknownOnly /* = false */) { Lock l(cs); if(unknownOnly) { for(User::NickIter i = users.begin(); i != users.end(); ++i) { if(i->second->getConnection().empty()) { getInfo(i->second); } } } else { clearUsers(); getNickList(); } }
int main(int argc, char *argv[]) { setUpServer(argc, argv); //start the server memset((char *) &fd, 0, sizeof(fd)); //clear out the fd clearUsers(); //clear out the user list while (1) //infinite loop { connectionWaiting(); } close(sockfd); return 0; //we never get here }
void Client::on(Failed, const string& aLine) noexcept { clearUsers(); if(stateNormal()) FavoriteManager::getInstance()->removeUserCommand(hubUrl); //Better ways to transfer the text in here?... string aError = aLine; if (secure && SETTING(ALLOW_UNTRUSTED_HUBS) && sock && !sock->isKeyprintMatch()) { aError += ", type /allow to proceed with untrusted connection"; iskeypError = true; } setConnectState(STATE_DISCONNECTED); statusMessage(aError, LogMessage::SEV_WARNING); //Error? sock->removeListener(this); fire(ClientListener::Failed(), getHubUrl(), aError); }
bool owperGUI::changeHiveFile(string newFileName, samHive* newSam/*=NULL*/) { gtk_entry_set_text(GTK_ENTRY(entrySamFile), ""); clearUsers(); if(sam) { delete sam; } // see if we were passed an already-loaded SAM hive // this may be the case if the program was asked to check // a hive on startup if(newSam != NULL) { sam = newSam; } else { // no, the sam file isn't loaded yet - try to load it try { sam = new samHive(newFileName.c_str()); }catch(owpException *exception) { //if sam got assigned something, delete it! if(sam) { delete sam; sam = NULL; } GtkWidget *errorDialog = gtk_message_dialog_new (GTK_WINDOW(this->winMain), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error loading hive:\n%s", exception->errorMessage.c_str()); gtk_dialog_run (GTK_DIALOG (errorDialog)); gtk_widget_destroy (errorDialog); delete exception; return false; } } gtk_entry_set_text(GTK_ENTRY(entrySamFile), newFileName.c_str()); loadUsers(); return true; }
KDModule::KDModule(QWidget *parent, const char *name, const QStringList &) : KCModule(KDMFactory::instance(), parent, name) , minshowuid(0) , maxshowuid(0) , updateOK(false) { KAboutData *about = new KAboutData(I18N_NOOP("kcmkdm"), I18N_NOOP("KDE Login Manager Config Module"), 0, 0, KAboutData::License_GPL, I18N_NOOP("(c) 1996 - 2005 The KDM Authors")); about->addAuthor("Thomas Tanghus", I18N_NOOP("Original author"), "*****@*****.**"); about->addAuthor("Steffen Hansen", 0, "*****@*****.**"); about->addAuthor("Oswald Buddenhagen", I18N_NOOP("Current maintainer"), "*****@*****.**"); setQuickHelp( i18n( "<h1>Login Manager</h1> In this module you can configure the " "various aspects of the KDE Login Manager. This includes " "the look and feel as well as the users that can be " "selected for login. Note that you can only make changes " "if you run the module with superuser rights. If you have not started the KDE " "Control Center with superuser rights (which is absolutely the right thing to " "do, by the way), click on the <em>Modify</em> button to acquire " "superuser rights. You will be asked for the superuser password." "<h2>Appearance</h2> On this tab page, you can configure how " "the Login Manager should look, which language it should use, and which " "GUI style it should use. The language settings made here have no influence on " "the user's language settings." "<h2>Font</h2>Here you can choose the fonts that the Login Manager should use " "for various purposes like greetings and user names. " "<h2>Background</h2>If you want to set a special background for the login " "screen, this is where to do it." "<h2>Shutdown</h2> Here you can specify who is allowed to shutdown/reboot the machine " "and whether a boot manager should be used." "<h2>Users</h2>On this tab page, you can select which users the Login Manager " "will offer you for logging in." "<h2>Convenience</h2> Here you can specify a user to be logged in automatically, " "users not needing to provide a password to log in, and other convenience features.<br>" "Note, that these settings are security holes by their nature, so use them very carefully.")); setAboutData( about ); setlocale( LC_COLLATE, "C" ); KGlobal::locale()->insertCatalogue("kcmbackground"); QStringList sl; QMap<gid_t,QStringList> tgmap; QMap<gid_t,QStringList>::Iterator tgmapi; QMap<gid_t,QStringList>::ConstIterator tgmapci; QMap<QString, QPair<int,QStringList> >::Iterator umapi; struct passwd *ps; for (setpwent(); (ps = getpwent()); ) { QString un( QFile::decodeName( ps->pw_name ) ); if (usermap.find( un ) == usermap.end()) { usermap.insert( un, QPair<int,QStringList>( ps->pw_uid, sl ) ); if ((tgmapi = tgmap.find( ps->pw_gid )) != tgmap.end()) (*tgmapi).append( un ); else tgmap[ps->pw_gid] = un; } } endpwent(); struct group *grp; for (setgrent(); (grp = getgrent()); ) { QString gn( QFile::decodeName( grp->gr_name ) ); bool delme = false; if ((tgmapi = tgmap.find( grp->gr_gid )) != tgmap.end()) { if ((*tgmapi).count() == 1 && (*tgmapi).first() == gn) delme = true; else for (QStringList::ConstIterator it = (*tgmapi).begin(); it != (*tgmapi).end(); ++it) usermap[*it].second.append( gn ); tgmap.remove( tgmapi ); } if (!*grp->gr_mem || (delme && !grp->gr_mem[1] && gn == QFile::decodeName( *grp->gr_mem ))) continue; do { QString un( QFile::decodeName( *grp->gr_mem ) ); if ((umapi = usermap.find( un )) != usermap.end()) { if ((*umapi).second.find( gn ) == (*umapi).second.end()) (*umapi).second.append( gn ); } else kdWarning() << "group '" << gn << "' contains unknown user '" << un << "'" << endl; } while (*++grp->gr_mem); } endgrent(); for (tgmapci = tgmap.begin(); tgmapci != tgmap.end(); ++tgmapci) kdWarning() << "user(s) '" << tgmapci.data().join(",") << "' have unknown GID " << tgmapci.key() << endl; config = new KSimpleConfig( QString::fromLatin1( KDE_CONFDIR "/kdm/kdmrc" )); QVBoxLayout *top = new QVBoxLayout(this); tab = new QTabWidget(this); // ***** // _don't_ add a theme configurator until the theming engine is _really_ done!! // ***** appearance = new KDMAppearanceWidget(this); tab->addTab(appearance, i18n("A&ppearance")); connect(appearance, SIGNAL(changed(bool)), SIGNAL( changed(bool))); font = new KDMFontWidget(this); tab->addTab(font, i18n("&Font")); connect(font, SIGNAL(changed(bool)), SIGNAL(changed(bool))); background = new KBackground(this); tab->addTab(background, i18n("&Background")); connect(background, SIGNAL(changed(bool)), SIGNAL(changed(bool))); sessions = new KDMSessionsWidget(this); tab->addTab(sessions, i18n("&Shutdown")); connect(sessions, SIGNAL(changed(bool)), SIGNAL(changed(bool))); users = new KDMUsersWidget(this, 0); tab->addTab(users, i18n("&Users")); connect(users, SIGNAL(changed(bool)), SIGNAL(changed(bool))); connect(users, SIGNAL(setMinMaxUID(int,int)), SLOT(slotMinMaxUID(int,int))); connect(this, SIGNAL(addUsers(const QMap<QString,int> &)), users, SLOT(slotAddUsers(const QMap<QString,int> &))); connect(this, SIGNAL(delUsers(const QMap<QString,int> &)), users, SLOT(slotDelUsers(const QMap<QString,int> &))); connect(this, SIGNAL(clearUsers()), users, SLOT(slotClearUsers())); convenience = new KDMConvenienceWidget(this, 0); tab->addTab(convenience, i18n("Con&venience")); connect(convenience, SIGNAL(changed(bool)), SIGNAL(changed(bool))); connect(this, SIGNAL(addUsers(const QMap<QString,int> &)), convenience, SLOT(slotAddUsers(const QMap<QString,int> &))); connect(this, SIGNAL(delUsers(const QMap<QString,int> &)), convenience, SLOT(slotDelUsers(const QMap<QString,int> &))); connect(this, SIGNAL(clearUsers()), convenience, SLOT(slotClearUsers())); load(); if (getuid() != 0 || !config->checkConfigFilesWritable( true )) { appearance->makeReadOnly(); font->makeReadOnly(); background->makeReadOnly(); users->makeReadOnly(); sessions->makeReadOnly(); convenience->makeReadOnly(); } top->addWidget(tab); }