void IRCSession::on_message_received(const IRCMessage &message) { /* // Do not remove this code. It is useful to see exactly what the server writes to us. IRCRawString s = IRCMessage::create_line(message.get_prefix().to_raw(), message.get_command(), message.get_params()); cb_system_text(IRCText::from_raw(s.substr(0, s.length()-2))); */ switch (message.get_type()) { case IRCMessage::type_numeric_reply: on_numeric_reply(IRCNumericReply(message)); break; case IRCMessage::type_nick: on_nick(IRCNickMessage(message)); break; case IRCMessage::type_join: on_join(IRCJoinMessage(message)); break; case IRCMessage::type_part: on_part(IRCPartMessage(message)); break; case IRCMessage::type_kick: on_kick(IRCKickMessage(message)); break; case IRCMessage::type_quit: on_quit(IRCQuitMessage(message)); break; case IRCMessage::type_channel_mode: on_channel_mode(IRCChannelModeMessage(message)); break; case IRCMessage::type_nick_mode: on_nick_mode(IRCNickModeMessage(message)); break; case IRCMessage::type_topic: on_topic(IRCTopicMessage(message)); break; case IRCMessage::type_privmsg: on_privmsg(IRCPrivateMessage(message)); break; case IRCMessage::type_notice: on_notice(IRCNoticeMessage(message)); break; case IRCMessage::type_ping: on_ping(IRCPingMessage(message)); break; case IRCMessage::type_unknown: default: on_unknown_message(message); break; } }
MyIrcBuffer::MyIrcBuffer(const QString& receiver, Irc::Session* parent) : Irc::Buffer(receiver, parent) { connect(this, SIGNAL(receiverChanged(QString)), SLOT(on_receiverChanged(QString))); connect(this, SIGNAL(joined(QString)), SLOT(on_joined(QString))); connect(this, SIGNAL(parted(QString, QString)), SLOT(on_parted(QString, QString))); connect(this, SIGNAL(quit(QString, QString)), SLOT(on_quit(QString, QString))); connect(this, SIGNAL(nickChanged(QString, QString)), SLOT(on_nickChanged(QString, QString))); connect(this, SIGNAL(modeChanged(QString, QString, QString)), SLOT(on_modeChanged(QString, QString, QString))); connect(this, SIGNAL(topicChanged(QString, QString)), SLOT(on_topicChanged(QString, QString))); connect(this, SIGNAL(invited(QString, QString, QString)), SLOT(on_invited(QString, QString, QString))); connect(this, SIGNAL(kicked(QString, QString, QString)), SLOT(on_kicked(QString, QString, QString))); connect(this, SIGNAL(messageReceived(QString, QString, Irc::Buffer::MessageFlags)), SLOT(on_messageReceived(QString, QString, Irc::Buffer::MessageFlags))); connect(this, SIGNAL(noticeReceived(QString, QString, Irc::Buffer::MessageFlags)), SLOT(on_noticeReceived(QString, QString, Irc::Buffer::MessageFlags))); connect(this, SIGNAL(ctcpRequestReceived(QString, QString, Irc::Buffer::MessageFlags)), SLOT(on_ctcpRequestReceived(QString, QString, Irc::Buffer::MessageFlags))); connect(this, SIGNAL(ctcpReplyReceived(QString, QString, Irc::Buffer::MessageFlags)), SLOT(on_ctcpReplyReceived(QString, QString, Irc::Buffer::MessageFlags))); connect(this, SIGNAL(ctcpActionReceived(QString, QString, Irc::Buffer::MessageFlags)), SLOT(on_ctcpActionReceived(QString, QString, Irc::Buffer::MessageFlags))); connect(this, SIGNAL(numericMessageReceived(QString, uint, QStringList)), SLOT(on_numericMessageReceived(QString, uint, QStringList))); connect(this, SIGNAL(unknownMessageReceived(QString, QStringList)), SLOT(on_unknownMessageReceived(QString, QStringList))); }
void MyIrcSession::onMessageReceived(IrcMessage *message) { LOG4CXX_INFO(logger, user << ": " << TO_UTF8(message->toString())); switch (message->type()) { case IrcMessage::Join: on_joined(message); break; case IrcMessage::Part: on_parted(message); break; case IrcMessage::Quit: on_quit(message); break; case IrcMessage::Nick: on_nickChanged(message); break; case IrcMessage::Mode: on_modeChanged(message); break; case IrcMessage::Topic: on_topicChanged(message); break; case IrcMessage::Private: on_messageReceived(message); break; case IrcMessage::Numeric: on_numericMessageReceived(message); break; default:break; } }
static void sigint_handler (int signo) { on_quit (); signal (signo, SIG_DFL); raise (signo); }
void Game::on_key_down(const CL_InputEvent &key, const CL_InputState &state) { if(key.id==CL_KEY_W) playerP->up(true); else if(key.id==CL_KEY_S) playerP->down(true); else if(key.id==CL_KEY_A) playerP->left(true); else if(key.id==CL_KEY_D) playerP->right(true); else if(key.id==CL_KEY_M) mute_music(); else if(key.id==CL_KEY_ESCAPE) on_quit(); }
MainObject::MainObject(QObject *parent) : QObject(parent) { //TODO Geoff to change this to object even static //= init the LOG file util_setStdLogFile(); //= Preferences Object settings = new XSettings(); debug_mode = settings->value("DEBUG_MODE","0").toBool(); //= Settings Model X = new XSettingsModel(this); connect(X, SIGNAL(upx(QString,bool,QString)), this, SLOT(on_upx(QString,bool,QString)) ); //================================================================ //= Processes - the nub.. //================================================================ processFgFs = new XProcess(this, "fgfs"); processTerraSync = new XProcess(this, "terrasync"); processFgCom = new XProcess(this, "fgcom"); //==================================== //= Set GLobal style QApplication::setStyle( QStyleFactory::create(settings->style_current()) ); //QApplication::setQuitOnLastWindowClosed(false); //===================================================================================== //== Tray Icon trayIcon = new QSystemTrayIcon(QIcon(":/icon/favicon"), this); trayIcon->setToolTip("FlightGear Launcher"); trayIcon->setVisible(true); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(on_tray_icon(QSystemTrayIcon::ActivationReason))); //== Tray Menu and actions popupMenu = new QMenu(); trayIcon->setContextMenu(popupMenu); //== Callsign - label in a widget.. actionCallsign = new QWidgetAction(this); lblCallsign = new QLabel(); lblCallsign->setText("(your callsign)"); lblCallsign->setStyleSheet("color: #000099; padding: 4px; font-weight: bold; background-color: white; border: 1px outset #cccccc;"); actionCallsign->setDefaultWidget(lblCallsign); popupMenu->addAction(actionCallsign); //= Launcher Action actionLauncher = popupMenu->addAction(QIcon(":icon/favicon"), tr("Open Launcher...")); actionLauncher->setIconVisibleInMenu(true); connect(actionLauncher, SIGNAL(triggered()), this, SLOT(on_launcher()) ); //= Browser MpMap action actionBrowserMap = popupMenu->addAction(QIcon(":icon/mpmap"), tr("Open Browser Map ...")); actionBrowserMap->setIconVisibleInMenu(true); connect(actionBrowserMap, SIGNAL(triggered()), this, SLOT(on_browsermap())); //== Properties browseer actionPropsBrowser = new QAction(this); actionPropsBrowser->setIcon(QIcon(":/icon/props")); actionPropsBrowser->setText(tr("Properties Browser...")); actionPropsBrowser->setIconVisibleInMenu(true); popupMenu->addAction(actionPropsBrowser); connect(actionPropsBrowser, SIGNAL(triggered()), this, SLOT(on_properties_browser()) ); popupMenu->addSeparator(); //== View Logs actionViewLogs = new QAction(this); actionViewLogs->setIcon(QIcon(":/icon/log")); actionViewLogs->setText(tr("View Logs")); actionViewLogs->setIconVisibleInMenu(true); popupMenu->addAction(actionViewLogs); connect(actionViewLogs, SIGNAL(triggered()), this, SLOT(on_view_logs()) ); //== Fgx Debug Logs actionViewFgxDebug = new QAction(this); actionViewFgxDebug->setIcon(QIcon(":/icon/log")); actionViewFgxDebug->setText(tr("FGx Debug")); actionViewFgxDebug->setIconVisibleInMenu(true); popupMenu->addAction(actionViewFgxDebug); connect(actionViewFgxDebug, SIGNAL(triggered()), this, SLOT(on_view_fgx_debug()) ); //== Debug Enabled /*actionDebugMode = new QAction(this); actionDebugMode->setText(tr("Debug Mode")); actionDebugMode->setCheckable(true); actionDebugMode->setChecked(debug_mode); popupMenu->addAction(actionDebugMode); connect(actionDebugMode, SIGNAL(triggered()), this, SLOT(set_debug_mode()) );*/ popupMenu->addSeparator(); //== Web Links QMenu *menuHelp = new QMenu(tr("Help")); popupMenu->addMenu(menuHelp); QActionGroup *actionGroupUrls = new QActionGroup(this); connect(actionGroupUrls, SIGNAL(triggered(QAction*)), this, SLOT(on_action_open_url(QAction*))); QAction *act = menuHelp->addAction(tr("Project Page")); act->setProperty("url", "http://code.google.com/p/fgx"); actionGroupUrls->addAction(act); act = menuHelp->addAction(tr("Bugs and Issues")); act->setProperty("url", "http://code.google.com/p/fgx/issues/list"); actionGroupUrls->addAction(act); act = menuHelp->addAction(tr("Source Code")); act->setProperty("url", "https://gitorious.org/fgx/fgx/"); actionGroupUrls->addAction(act); menuHelp->addSeparator(); menuHelp->addAction(tr("About FGx"), this, SLOT(on_about_fgx())); menuHelp->addAction(tr("About Qt"), this, SLOT(on_about_qt())); popupMenu->addSeparator(); //== Quit actionQuit = popupMenu->addAction(QIcon(":/icon/quit"), tr("Quit")); actionQuit->setIconVisibleInMenu(true); connect(actionQuit, SIGNAL(triggered()), this, SLOT(on_quit())); //================== trayIcon->show(); //connect(this, SIGNAL(show_settings(int)), this, SLOT(on_settings(int))); //== Props tree propertiesBrowser = new PropsTreeWidget(this); propertiesBrowser->hide(); //= Log Viewer is hidden viewLogsWidget = new ViewLogsWidget(this); viewLogsWidget->hide(); //= FGx Debug Widget fgxDebugWidget = new FgxDebugWidget(this); if(settings->value("fgx_debug_show_on_startup",0).toBool()){ fgxDebugWidget->show(); } launcherWindow = new LauncherWindow(this); //launcherWindow->hide(); //== initialise after initial show so UI dont look frozen while cache loading etc QTimer::singleShot(300, this, SLOT(initialize())); }
/** * process_incomming_data: handles a raw irc line minus the \r\n that * has already been removed in the handle_receive event. * @param line */ void Client::process_incomming_data(std::string &line) { session_t session; int pos; line = trim(line); //std::cout << "server->'" << line << "'" << std::endl; // Get the prefix if (line.at(0) == ':') { if ((pos = line.find(' ')) > 0) { session.prefix = line.substr(1, pos - 1); line = line.substr(pos); } } line = ltrim(line); // Get the code or the command session.code = 0; if (isdigit(line.at(0)) && isdigit(line.at(1)) && isdigit(line.at(2))) { session.code = atoi(line.substr(0, 3).c_str()); line = line.substr(3); } else if ((pos = line.find(' ')) > 0) { session.command = line.substr(0, pos); line = line.substr(pos); } else { // just drop line for now. return; } line = ltrim(line); // Get the params session.param_count = 0; while (line.length() > 0 && session.param_count < 15) { // Message if (line.at(0) == ':') { session.trailing = line.substr(1); break; } // Params if ((pos = line.find(' ')) > 0) { session.params[session.param_count] = line.substr(0, pos); session.param_count++; line = line.substr(pos); line = ltrim(line); } else { session.params[session.param_count] = line; session.param_count++; break; } } //std::cout << "prefix: '" << session.prefix << "', command: '" << session.command << "', code: " << session.code << ", message: '" << session.trailing << "', param_count: " << session.param_count << ", params[0]: '" << session.params[0] << "', params[1]: '" << session.params[1] << "', params[2]: '" << session.params[2] << "'" << std::endl; // Handle Codes switch (session.code) { // We use the MOTD as a signal that we are fully connected to IRC. case RPL_ENDOFMOTD: case ERR_NOMOTD: on_connected(); break; case ERR_NONICKNAMEGIVEN: case ERR_ERRONEUSNICKNAME: case ERR_NICKNAMEINUSE: case ERR_NICKCOLLISION: on_nick_error(session); } // Handle Commands if (session.command == "JOIN") on_join(session); else if (session.command == "NICK") on_nick(session); else if (session.command == "NOTICE") on_notice(session); else if (session.command == "PART") on_part(session); else if (session.command == "PING") on_ping(session); else if (session.command == "PRIVMSG") on_privmsg(session); else if (session.command == "QUIT") on_quit(session); //std::cout << "---------------------------------------------------------------------------------------------------------------------------" << std::endl; }
bool MainWindow::on_delete_event(GdkEventAny* event) { on_quit(); return false; }
void applet_exit(int code) { on_quit(); exit(code); }
virtual void on_system_shutdown() { on_quit(); }
static void quit_signal_handler(G_GNUC_UNUSED int signum) { on_quit(); }