// virtual BOOL LLChatBar::handleKeyHere( KEY key, MASK mask ) { BOOL handled = FALSE; // ALT-RETURN is reserved for windowed/fullscreen toggle if( KEY_RETURN == key ) { if (mask == MASK_CONTROL) { // shout sendChat(CHAT_TYPE_SHOUT); handled = TRUE; } else if (mask == MASK_NONE) { // say sendChat( CHAT_TYPE_NORMAL ); handled = TRUE; } } // only do this in main chatbar else if ( KEY_ESCAPE == key && gChatBar == this) { stopChat(); handled = TRUE; } return handled; }
// virtual BOOL FSFloaterNearbyChat::handleKeyHere( KEY key, MASK mask ) { BOOL handled = FALSE; if (KEY_RETURN == key) { if (mask == MASK_CONTROL) { // shout mInputEditor->updateHistory(); sendChat(CHAT_TYPE_SHOUT); handled = TRUE; } else if (mask == MASK_SHIFT) { // whisper mInputEditor->updateHistory(); sendChat(CHAT_TYPE_WHISPER); handled = TRUE; } else if (mask == MASK_ALT) { // OOC mInputEditor->updateHistory(); sendChat(CHAT_TYPE_OOC); handled = TRUE; } } return handled; }
// virtual BOOL LLNearbyChatBar::handleKeyHere( KEY key, MASK mask ) { BOOL handled = FALSE; if( KEY_RETURN == key ) { if (mask == MASK_CONTROL) { // shout sendChat(CHAT_TYPE_SHOUT); handled = TRUE; } else if (mask == MASK_SHIFT) { // whisper sendChat(CHAT_TYPE_WHISPER); handled = TRUE; } else if (mask == MASK_ALT) { // OOC sendChat(CHAT_TYPE_OOC); handled = TRUE; } else if (mask == MASK_NONE) { // say sendChat( CHAT_TYPE_NORMAL ); handled = TRUE; } } return handled; }
void LLNearbyChatBar::onChatBoxCommit() { if (mChatBox->getText().length() > 0) { sendChat(CHAT_TYPE_NORMAL); } gAgent.stopTyping(); }
void ClientMessage(RPCParameters *rpcParams) { //if(!iGameInited) return; PCHAR Data = reinterpret_cast<PCHAR>(rpcParams->input); int iBitLength = rpcParams->numberOfBitsOfData; RakNet::BitStream bsData((unsigned char *)Data,(iBitLength/8)+1,false); DWORD dwStrLen, dwColor; char szMsg[257]; memset(szMsg, 0, 257); bsData.Read(dwColor); bsData.Read(dwStrLen); if(dwStrLen > 256) return; bsData.Read(szMsg, dwStrLen); szMsg[dwStrLen] = 0; if(settings.iFind) { for(int i = 0; i < MAX_FIND_ITEMS; i++) { if(!settings.findItems[i].iExists) continue; if(strstr(szMsg, settings.findItems[i].szFind)) if(settings.findItems[i].szSay[0] != 0x00) sendChat(settings.findItems[i].szSay); } } char szNonColorEmbeddedMsg[257]; int iNonColorEmbeddedMsgLen = 0; for (size_t pos = 0; pos < strlen(szMsg) && szMsg[pos] != '\0'; pos++) { if (!((*(unsigned char*)(&szMsg[pos]) - 32) >= 0 && (*(unsigned char*)(&szMsg[pos]) - 32) < 224)) continue; if(pos+7 < strlen(szMsg)) { if (szMsg[pos] == '{' && szMsg[pos+7] == '}') { pos += 7; continue; } } szNonColorEmbeddedMsg[iNonColorEmbeddedMsgLen] = szMsg[pos]; iNonColorEmbeddedMsgLen++; } szNonColorEmbeddedMsg[iNonColorEmbeddedMsgLen] = 0; Log("[CMSG] %s", szNonColorEmbeddedMsg); }
// virtual BOOL LLNearbyChatBar::handleKeyHere( KEY key, MASK mask ) { BOOL handled = FALSE; if( KEY_RETURN == key && mask == MASK_CONTROL) { // shout sendChat(CHAT_TYPE_SHOUT); handled = TRUE; } else if( KEY_RETURN == key && mask == MASK_SHIFT) { // whisper S21 sendChat(CHAT_TYPE_WHISPER); handled = TRUE; } return handled; }
void PopupChatDialog::checkChat() { /* if <return> at the end of the text -> we can send it! */ QTextEdit *chatWidget = ui.chattextEdit; std::string txt = chatWidget->toPlainText().toStdString(); if ('\n' == txt[txt.length()-1] && txt.length()-1 == txt.find('\n')) /* only if on first line! */ sendChat(); else updateStatusTyping() ; }
void Chat(RPCParameters *rpcParams) { if(!iGameInited) return; PCHAR Data = reinterpret_cast<PCHAR>(rpcParams->input); int iBitLength = rpcParams->numberOfBitsOfData; PlayerID sender = rpcParams->sender; RakNet::BitStream bsData((unsigned char *)Data,(iBitLength/8)+1,false); PLAYERID playerId; BYTE byteTextLen; unsigned char szText[256]; memset(szText, 0, 256); bsData.Read(playerId); bsData.Read(byteTextLen); bsData.Read((char*)szText, byteTextLen); szText[byteTextLen] = 0; if(playerId < 0 || playerId >= MAX_PLAYERS) return; if(imitateID == playerId) sendChat((char *)szText); Log("[CHAT] %s: %s", playerInfo[playerId].szPlayerName, szText); if(settings.iFind) { for(int i = 0; i < MAX_FIND_ITEMS; i++) { if(!settings.findItems[i].iExists) continue; if(strstr((const char *)szText, settings.findItems[i].szFind)) { if(settings.findItems[i].szSay[0] != 0x00) sendChat(settings.findItems[i].szSay); } } } }
void sampChatFlood() { if(GetTickCount() - dwLastChatFlood >= settings.uiChatFloodInterval) { char szRandomMessage[60 + 1]; gen_random(szRandomMessage, 60); sendChat(szRandomMessage); dwLastChatFlood = GetTickCount(); } }
bool ChatWidget::eventFilter(QObject *obj, QEvent *event) { if (obj == ui->chatTextEdit) { if (event->type() == QEvent::KeyPress) { updateStatusTyping(); QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event); if (keyEvent && (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return)) { // Enter pressed if (Settings->getChatSendMessageWithCtrlReturn()) { if (keyEvent->modifiers() & Qt::ControlModifier) { // send message with Ctrl+Enter sendChat(); return true; // eat event } } else { if (keyEvent->modifiers() & Qt::ControlModifier) { // insert return ui->chatTextEdit->textCursor().insertText("\n"); } else { // send message with Enter sendChat(); } return true; // eat event } } } } else { if (event->type() == QEvent::WindowActivate) { if (isVisible() && (window() == NULL || window()->isActiveWindow())) { newMessages = false; emit infoChanged(this); focusDialog(); } } } // pass the event on to the parent class return QWidget::eventFilter(obj, event); }
// static void LLChatBar::onClickSay( LLUICtrl* ctrl ) { std::string cmd = ctrl->getValue().asString(); e_chat_type chat_type = CHAT_TYPE_NORMAL; if (cmd == "shout") { chat_type = CHAT_TYPE_SHOUT; } else if (cmd == "whisper") { chat_type = CHAT_TYPE_WHISPER; } sendChat(chat_type); }
/** * Tastendruck verarbeiten **/ bool CGameFinishDialog::processKey(unsigned short key) { /* Wird hier Escape gedrueckt. */ if (key==VK_ESCAPE) { /* Verbindung zum Server kappen. */ gui->spiel->Disconnect(); /* Dialog schliessen. */ close(); return true; } /* Dialog die Taste verarbeiten lassen. */ bool b=CDialog::processKey(key); /* Und wenn das Text-Feld mit Enter verlassen wurde, Nachricht verschicken */ if (chat && chat->committed())sendChat(); return b; }
BOOL CChatEdit::PreTranslateMessage(MSG* pMsg) { if (pMsg->message == WM_KEYDOWN) { switch (pMsg->wParam) { case VK_ESCAPE: SetWindowText(""); return TRUE; case VK_RETURN: sendChat(); return TRUE; } } return CEdit::PreTranslateMessage(pMsg); }
/** * Mausereignis verarbeiten (Druck auf Button) **/ int CGameFinishDialog::processMouseEvent(TMouseEvent *event) { int r=CDialog::processMouseEvent(event); /* Chat-Nachricht senden. */ if (r==96)sendChat(); else if (r==17) /* Neue Runde starten und Dialog schliessen. */ { gui->spiel->request_start(); close(); }else if (r==18) { /* Verbindung zum Server trennen und Dialog schliessen. */ close(); gui->spiel->Disconnect(); }else return r; return 0; }
/** * Tastendruck verarbeiten. **/ bool CStartGameDialog::processKey(unsigned short key) { /* Wird hier Escape gedrueckt. */ if (key==VK_ESCAPE) { /* Verbindung zum Server kappen. */ if (client)client->Disconnect(); client=0; /* Chatbox darf wieder automatisch geschlosen werden. */ gui->setChatBoxSticky(false); /* Dialog schliessen. */ close(); return true; } /* Sonst Rest des Dialogs die Nachricht verarbeiten lassen. */ bool b=CDialog::processKey(key); /* Und wenn ueber dem Chat EditFeld Enter gedrueckt wurde, die Nachricht abschicken. */ if (chat->committed())sendChat(); return b; }
void FSFloaterNearbyChat::onChatBoxCommit() { if (mInputEditor->getText().length() > 0) { EChatType type=CHAT_TYPE_NORMAL; if(gSavedSettings.getBOOL("FSShowChatType")) { std::string typeString=mChatTypeCombo->getValue(); if(typeString=="whisper") { type=CHAT_TYPE_WHISPER; } else if(typeString=="shout") { type=CHAT_TYPE_SHOUT; } } sendChat(type); } gAgent.stopTyping(); }
/** * Mausereignis verarbeiten (Druck auf Button). **/ int CStartGameDialog::processMouseEvent(TMouseEvent *event) { /* Dialog das Event verarbeiten lassen. */ int r=CDialog::processMouseEvent(event); /* Spielstart wurde betaetigt. */ if (r==99) { /* Spiel starten. Der Dialog schliesst sich von allein, sobald das Spiel laeuft. */ if (client)client->request_start(); return 0; }else if (r==98) { /* Close-Button wurde betaetigt. Verbindung zum Server kappen und Dialog schliessen. */ if (client)client->Disconnect(); gui->setChatBoxSticky(false); close(); return 0; }else if (r==96) { /* Chat-Nachricht abschicken. */ sendChat(); return 0; }else return r; }
/** Default constructor */ ChatWindow::ChatWindow(QWidget *parent) : QMainWindow(parent) { /* Invoke Qt Designer generated QObject setup routine */ ui.setupUi(this); GConfig config; config.loadWidgetInformation(this); _isAvatarFrameOpened = true; //creates sub widgets _avatarFrame = new ChatAvatarFrame(this); //// connect(ui.lineEdit, SIGNAL(returnPressed( ) ), this, SLOT(sendChat( ) )); connect(ui.colorButton, SIGNAL(clicked()), this, SLOT(setColor())); connect(ui.textboldButton, SIGNAL(clicked()), this, SLOT(textBold())); connect(ui.textunderlineButton, SIGNAL(clicked()), this, SLOT(textUnderline())); connect(ui.textitalicButton, SIGNAL(clicked()), this, SLOT(textItalic())); connect(ui.avatarFrameButton, SIGNAL(clicked()), SLOT(avatarFrameButtonClicked())); addAvatarFrame(); }
/** Default constructor */ PopupChatDialog::PopupChatDialog(const std::string &id, const QString &name, QWidget *parent, Qt::WFlags flags) : QWidget(parent, flags), dialogId(id), dialogName(name), lastChatTime(0), lastChatName("") { /* Invoke Qt Designer generated QObject setup routine */ ui.setupUi(this); newMessages = false; typing = false; m_manualDelete = false; peerStatus = 0; last_status_send_time = 0 ; chatStyle.setStyleFromSettings(ChatStyle::TYPE_PRIVATE); /* Hide or show the frames */ showAvatarFrame(PeerSettings->getShowAvatarFrame(dialogId)); ui.infoframe->setVisible(false); ui.statusmessagelabel->hide(); connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool))); connect(ui.sendButton, SIGNAL(clicked( ) ), this, SLOT(sendChat( ) )); connect(ui.addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile())); connect(ui.textboldButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.textunderlineButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.textitalicButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.attachPictureButton, SIGNAL(clicked()), this, SLOT(addExtraPicture())); connect(ui.fontButton, SIGNAL(clicked()), this, SLOT(getFont())); connect(ui.colorButton, SIGNAL(clicked()), this, SLOT(setColor())); connect(ui.emoteiconButton, SIGNAL(clicked()), this, SLOT(smileyWidget())); connect(ui.actionSave_Chat_History, SIGNAL(triggered()), this, SLOT(fileSaveAs())); connect(ui.actionClearOfflineMessages, SIGNAL(triggered()), this, SLOT(clearOfflineMessages())); connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&, int)), this, SLOT(updateStatus(const QString&, int))); connect(NotifyQt::getInstance(), SIGNAL(peerHasNewCustomStateString(const QString&, const QString&)), this, SLOT(updatePeersCustomStateString(const QString&, const QString&))); connect(ui.chattextEdit,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenu(QPoint))); // Create the status bar resetStatusBar(); ui.textboldButton->setIcon(QIcon(QString(":/images/edit-bold.png"))); ui.textunderlineButton->setIcon(QIcon(QString(":/images/edit-underline.png"))); ui.textitalicButton->setIcon(QIcon(QString(":/images/edit-italic.png"))); ui.fontButton->setIcon(QIcon(QString(":/images/fonts.png"))); ui.emoteiconButton->setIcon(QIcon(QString(":/images/emoticons/kopete/kopete020.png"))); ui.textboldButton->setCheckable(true); ui.textunderlineButton->setCheckable(true); ui.textitalicButton->setCheckable(true); setAcceptDrops(true); ui.chattextEdit->setAcceptDrops(false); QMenu * toolmenu = new QMenu(); toolmenu->addAction(ui.actionClear_Chat_History); toolmenu->addAction(ui.actionDelete_Chat_History); toolmenu->addAction(ui.actionSave_Chat_History); toolmenu->addAction(ui.actionClearOfflineMessages); toolmenu->addAction(ui.actionMessageHistory); //toolmenu->addAction(ui.action_Disable_Emoticons); ui.pushtoolsButton->setMenu(toolmenu); mCurrentColor.setNamedColor(PeerSettings->getPrivateChatColor(dialogId)); mCurrentFont.fromString(PeerSettings->getPrivateChatFont(dialogId)); colorChanged(mCurrentColor); fontChanged(mCurrentFont); updateAvatar() ; updatePeerAvatar(id) ; // load settings processSettings(true); // load style PeerSettings->getStyle(dialogId, "PopupChatDialog", style); // initialize first status StatusInfo peerStatusInfo; // No check of return value. Non existing status info is handled as offline. rsStatus->getStatus(dialogId, peerStatusInfo); updateStatus(QString::fromStdString(dialogId), peerStatusInfo.status); StatusInfo ownStatusInfo; if (rsStatus->getOwnStatus(ownStatusInfo)) { updateStatus(QString::fromStdString(ownStatusInfo.id), ownStatusInfo.status); } // initialize first custom state string QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(dialogId).c_str()); updatePeersCustomStateString(QString::fromStdString(dialogId), customStateString); if (Settings->valueFromGroup("Chat", QString::fromUtf8("PrivateChat_History"), true).toBool()) { historyKeeper.init(QString::fromStdString(RsInit::RsProfileConfigDirectory()) + "/chat_" + QString::fromStdString(dialogId) + ".xml"); // get offline chat messages std::list<ChatInfo> offlineChat; std::list<ChatInfo>::iterator offineChatIt; rsMsgs->getPrivateChatQueueCount(false) && rsMsgs->getPrivateChatQueue(false, dialogId, offlineChat); QList<IMHistoryItem> historyItems; int messageCount = Settings->getPrivateChatHistoryCount(); if (messageCount > 0) { historyKeeper.getMessages(historyItems, messageCount); } foreach(IMHistoryItem item, historyItems) { for(offineChatIt = offlineChat.begin(); offineChatIt != offlineChat.end(); offineChatIt++) { /* are they public? */ if ((offineChatIt->chatflags & RS_CHAT_PRIVATE) == 0) { /* this should not happen */ continue; } QDateTime sendTime = QDateTime::fromTime_t(offineChatIt->sendTime); QString message = QString::fromStdWString(offineChatIt->msg); if (IMHistoryKeeper::compareItem(item, false, offineChatIt->rsid, sendTime, message)) { // don't show offline message out of the history break; } } if (offineChatIt == offlineChat.end()) { addChatMsg(item.incoming, item.id, item.name, item.sendTime, item.recvTime, item.messageText, TYPE_HISTORY, false); } } }
void CMainWindow::connectSignals() { CChatManager *Manager = CChatManager::instance(); CNetworkClient *Network = CNetworkClient::instance(); CBattleManager *BattleManager = CBattleManager::instance(); connect(ui->ChatTabWidget->tabBar(), SIGNAL(tabCloseRequested(int)), Manager, SLOT(closeChannel(int))); connect(ui->ChatTabWidget->tabBar(), SIGNAL(currentChanged(int)), Manager, SLOT(changeCurrentChannel(int))); connect(ui->ChatTabWidget->tabBar(), SIGNAL(tabMoved(int,int)), Manager, SLOT(moveChannel(int,int))); connect(Manager, SIGNAL(joined(CChannel*)), this, SLOT(createTab(CChannel*))); connect(Manager, SIGNAL(closeTab(int)), this, SLOT(removeTab(int))); connect(Manager, SIGNAL(currentChanged(CChannel*)), ui->ChatTabWidget->chatView(), SLOT(loadChannel(CChannel*))); connect(ui->ChannelsView, SIGNAL(doubleClicked(QModelIndex)), CChatManager::instance(), SLOT(doubleClicked(QModelIndex))); connect(ui->ChannelUserView, SIGNAL(doubleClicked(QModelIndex)), CUserManager::instance()->chatModel(), SLOT(doubleClicked(QModelIndex))); connect(ui->actionChatSend, SIGNAL(triggered()), this, SLOT(sendChat())); connect(ui->actionBattleSend, SIGNAL(triggered()), this, SLOT(sendBattle())); connect(Manager, SIGNAL(currentChanged(int)), ui->ChatTabWidget->tabBar(), SLOT(setCurrentIndex(int))); connect(ui->BattleListView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), CBattleManager::instance(), SLOT(battleSelected(QModelIndex))); connect(ui->BattleListView, SIGNAL(doubleClicked(QModelIndex)), CBattleManager::instance(), SLOT(doubleClicked(QModelIndex))); connect(ui->BattlePreviewView, SIGNAL(doubleClicked(QModelIndex)), CBattleManager::instance()->battlePreviewModel(), SLOT(doubleClicked(QModelIndex))); connect(ui->actionConnect, SIGNAL(triggered()), this, SLOT(showConnectDialog())); connect(&ConnectDialog, SIGNAL(connect(QString,int,QString,QString)), Network, SLOT(connectToServer(QString,int,QString,QString))); connect(Network, SIGNAL(disconnected()), this, SLOT(networkDisconnected())); connect(Network, SIGNAL(connected()), this, SLOT(networkConnected())); connect(Network, SIGNAL(multiplayerDisabled()), this, SLOT(disableMultiplayerGUI())); connect(Network, SIGNAL(multiplayerEnabled()), this, SLOT(enableMultiplayerGUI())); connect(ui->actionDisconnect, SIGNAL(triggered()), Network, SLOT(disconnect())); connect(CBattleManager::instance(), SIGNAL(currentMapChanged(CMap*)), ui->MapInfo, SLOT(setMap(CMap*))); connect(CBattleroomManager::instance(), SIGNAL(mapChanged(CMap*)), ui->BattleMapInfo, SLOT(setMap(CMap*))); connect(CBattleroomManager::instance(), SIGNAL(updateChat(CChannel*)), ui->BattleChatText, SLOT(loadChannel(CChannel*))); connect(CBattleroomManager::instance(), SIGNAL(error(int,QString)), this, SLOT(error(int,QString))); connect(ui->LeaveBattleButton, SIGNAL(clicked()), CBattleroomManager::instance(), SLOT(leaveBattle())); connect(ui->DownloadButton, SIGNAL(clicked()), this, SLOT(execDownload())); connect(ui->actionDeleteDownload, SIGNAL(triggered()), this, SLOT(removeDownload())); connect(ui->actionDownloadMap, SIGNAL(triggered()), BattleManager, SLOT(downloadMapForBattle())); connect(ui->actionDownloadMod, SIGNAL(triggered()), BattleManager, SLOT(downloadModForBattle())); connect(ui->DownloadView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showDownloadContextMenu(QPoint))); connect(ui->BattleListView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showBattleContextMenu(QPoint))); connect(Network, SIGNAL(error(int,QString)), this, SLOT(error(int,QString))); connect(CDownloadManager::instance(), SIGNAL(error(int,QString)), this, SLOT(error(int,QString))); connect(Manager, SIGNAL(error(int,QString)), this, SLOT(error(int,QString))); connect(CDownloadManager::instance(), SIGNAL(error(int,QString)), this, SLOT(error(int,QString))); connect(Network, SIGNAL(agreement(QString)), this, SLOT(showAgreement(QString))); connect(ui->actionReloadUnitSync, SIGNAL(triggered()), CUnitSync::instance(), SLOT(reload())); connect(CUnitSync::instance(), SIGNAL(error(int,QString)), this, SLOT(error(int,QString))); connect(CUserManager::instance(), SIGNAL(lobbyUserBattleStatusChanged(CBattleStatus*)), this, SLOT(updateBattleStatus(CBattleStatus*))); connect(CUnitSync::instance(), SIGNAL(loaded()), this, SLOT(unitsyncLoaded())); connect(CUnitSync::instance(), SIGNAL(unloaded()), this, SLOT(unitsyncUnloaded())); connect(ui->actionUpdateStatus, SIGNAL(triggered()), this, SLOT(changeBattleStatus())); connect(CBattleroomManager::instance(), SIGNAL(battleJoined(CBattle*)), this, SLOT(enableBattleroom(CBattle*))); connect(CBattleroomManager::instance(), SIGNAL(battleClosed()), this, SLOT(disableBattleroom())); connect(CBattleroomManager::instance(), SIGNAL(gameStarted()), this, SLOT(lockBattleroom())); connect(CBattleroomManager::instance(), SIGNAL(gameEnded()), this, SLOT(unlockBattleroom())); connect(CBattleroomManager::instance(), SIGNAL(battleStarted()), this, SLOT(onBattleStarted())); connect(CBattleroomManager::instance(), SIGNAL(battleEnded()), this, SLOT(onBattleEnded())); connect(ui->SelectColorButton, SIGNAL(clicked()), this, SLOT(selectColor())); connect(ui->StartBattleButton, SIGNAL(clicked()), CBattleroomManager::instance(), SLOT(startGame())); connect(&ColorDialog, SIGNAL(colorSelected(QColor)), this, SLOT(colorSelected(QColor))); }
// virtual BOOL LLChatBar::handleKeyHere( KEY key, MASK mask ) { BOOL handled = FALSE; // ALT-RETURN is reserved for windowed/fullscreen toggle if( KEY_RETURN == key ) { if (mask == MASK_CONTROL) { // shout sendChat(CHAT_TYPE_SHOUT); handled = TRUE; } else if (mask == MASK_SHIFT) { // whisper sendChat( CHAT_TYPE_WHISPER ); handled = TRUE; } else if (mask == MASK_NONE) { // say sendChat( CHAT_TYPE_NORMAL ); handled = TRUE; } } // only do this in main chatbar else if (KEY_ESCAPE == key && mask == MASK_NONE && gChatBar == this) { stopChat(); handled = TRUE; } else if (key == KEY_TAB) { if (mInputEditor) { mInputEditor->deleteSelection(); // Clean up prev completion before attempting a new one std::string txt(mInputEditor->getText()); std::vector<LLUUID> avatar_ids; std::vector<LLVector3d> positions; LLWorld::getInstance()->getAvatars(&avatar_ids, &positions); if (!avatar_ids.empty() && !txt.empty()) { if (mCompletionHolder.cursorPos == -1) // Ele: cache cursor position mCompletionHolder.cursorPos = mInputEditor->getCursor(); if (mCompletionHolder.last_txt != mInputEditor->getText()) { mCompletionHolder.last_txt = std::string(mInputEditor->getText()); if (mCompletionHolder.cursorPos < (S32)txt.length()) { mCompletionHolder.right = txt.substr(mCompletionHolder.cursorPos); mCompletionHolder.left = txt.substr(0, mCompletionHolder.cursorPos); mCompletionHolder.match = std::string(mCompletionHolder.left); } else { mCompletionHolder.right = ""; mCompletionHolder.match = std::string(txt); mCompletionHolder.left = txt; } std::string pattern_s = "(^|.*[_=&\\|\\<\\>#@\\[\\]\\-\\+\"',\\.\\?!:;\\*\\(\\)\\s]+)([a-z0-9]+)$"; boost::match_results<std::string::const_iterator> what; boost::regex expression(pattern_s, boost::regex::icase); if (boost::regex_search(mCompletionHolder.match, what, expression, boost::match_extra)) { mCompletionHolder.match = what[2]; if (mCompletionHolder.match.length() < 1) return handled; } else return handled; } mCompletionHolder.names.clear(); for (U32 i=0; i<avatar_ids.size(); i++) { if (avatar_ids[i] == gAgent.getID() || avatar_ids[i].isNull()) continue; std::string agent_name = " "; std::string agent_surname = " "; if(!gCacheName->getName(avatar_ids[i], agent_name, agent_surname) && (agent_name == " " || agent_surname == " ")) continue; std::string test_name(agent_name); std::transform(test_name.begin(), test_name.end(), test_name.begin(), tolower); std::transform(mCompletionHolder.match.begin(), mCompletionHolder.match.end(), mCompletionHolder.match.begin(), tolower); if (test_name.find(mCompletionHolder.match) == 0) mCompletionHolder.names.push_back(agent_name); } if (mCompletionHolder.current_index >= (S32)mCompletionHolder.names.size() || mCompletionHolder.match != mCompletionHolder.last_match) { mCompletionHolder.current_index = 0; mCompletionHolder.last_match = mCompletionHolder.match; } if (mCompletionHolder.names.size() > 0) { std::string current_name = mCompletionHolder.names[mCompletionHolder.current_index]; mInputEditor->setText(mCompletionHolder.left.substr(0, mCompletionHolder.left.length() - mCompletionHolder.match.length()) + current_name + mCompletionHolder.right); mInputEditor->setCursor(mCompletionHolder.cursorPos + (current_name.length() - mCompletionHolder.match.length())); mInputEditor->setSelection(mCompletionHolder.cursorPos, mCompletionHolder.cursorPos + (current_name.length() - mCompletionHolder.match.length())); mCompletionHolder.current_index++; mCompletionHolder.selected = TRUE; return TRUE; } } } } return handled; }
/** Default constructor */ PopupChatDialog::PopupChatDialog(std::string id, std::string name, QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags), dialogId(id), dialogName(name), lastChatTime(0), lastChatName("") { /* Invoke Qt Designer generated QObject setup routine */ ui.setupUi(this); RshareSettings config; config.loadWidgetInformation(this); loadEmoticons(); last_status_send_time = 0 ; styleHtm = ":/qss/chat/default.htm"; /* Hide Avatar frame */ showAvatarFrame(false); connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool))); connect(ui.actionAvatar, SIGNAL(triggered()),this, SLOT(getAvatar())); connect(ui.chattextEdit, SIGNAL(textChanged ( ) ), this, SLOT(checkChat( ) )); connect(ui.sendButton, SIGNAL(clicked( ) ), this, SLOT(sendChat( ) )); connect(ui.addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile())); connect(ui.textboldButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.textunderlineButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.textitalicButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.fontButton, SIGNAL(clicked()), this, SLOT(getFont())); connect(ui.colorButton, SIGNAL(clicked()), this, SLOT(setColor())); connect(ui.emoteiconButton, SIGNAL(clicked()), this, SLOT(smileyWidget())); connect(ui.styleButton, SIGNAL(clicked()), SLOT(changeStyle())); connect(ui.textBrowser, SIGNAL(anchorClicked(const QUrl &)), SLOT(anchorClicked(const QUrl &))); // Create the status bar resetStatusBar() ; ui.textBrowser->setOpenExternalLinks ( false ); ui.textBrowser->setOpenLinks ( false ); QString title = QString::fromStdString(name) + " :" + tr(" RetroShare - Encrypted Chat") ; setWindowTitle(title); //set the default avatar //ui.avatarlabel->setPixmap(QPixmap(":/images/retrosharelogo1.png")); setWindowIcon(QIcon(QString(":/images/rstray3.png"))); ui.textboldButton->setIcon(QIcon(QString(":/images/edit-bold.png"))); ui.textunderlineButton->setIcon(QIcon(QString(":/images/edit-underline.png"))); ui.textitalicButton->setIcon(QIcon(QString(":/images/edit-italic.png"))); ui.fontButton->setIcon(QIcon(QString(":/images/fonts.png"))); ui.emoteiconButton->setIcon(QIcon(QString(":/images/emoticons/kopete/kopete020.png"))); ui.styleButton->setIcon(QIcon(QString(":/images/looknfeel.png"))); ui.textboldButton->setCheckable(true); ui.textunderlineButton->setCheckable(true); ui.textitalicButton->setCheckable(true); setAcceptDrops(true); ui.chattextEdit->setAcceptDrops(false); /*Disabled style Button when will switch chat style RetroShare will crash need to be fix */ //ui.styleButton->setEnabled(false); /*QMenu * fontmenu = new QMenu(); fontmenu->addAction(ui.actionBold); fontmenu->addAction(ui.actionUnderline); fontmenu->addAction(ui.actionItalic); fontmenu->addAction(ui.actionStrike); ui.fontButton->setMenu(fontmenu);*/ mCurrentColor = Qt::black; mCurrentFont = QFont("Comic Sans MS", 10); colorChanged(mCurrentColor); setFont(); updateAvatar() ; updatePeerAvatar(id) ; }
ChatWidget::ChatWidget(QWidget *parent) : QWidget(parent), ui(new Ui::ChatWidget) { ui->setupUi(this); newMessages = false; typing = false; peerStatus = 0; isChatLobby = false; firstShow = true; inChatCharFormatChanged = false; lastStatusSendTime = 0 ; connect(ui->sendButton, SIGNAL(clicked()), this, SLOT(sendChat())); connect(ui->addFileButton, SIGNAL(clicked()), this , SLOT(addExtraFile())); connect(ui->textboldButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui->textunderlineButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui->textitalicButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui->attachPictureButton, SIGNAL(clicked()), this, SLOT(addExtraPicture())); connect(ui->colorButton, SIGNAL(clicked()), this, SLOT(chooseColor())); connect(ui->emoteiconButton, SIGNAL(clicked()), this, SLOT(smileyWidget())); connect(ui->actionSaveChatHistory, SIGNAL(triggered()), this, SLOT(fileSaveAs())); connect(ui->actionClearChatHistory, SIGNAL(triggered()), this, SLOT(clearChatHistory())); connect(ui->actionDeleteChatHistory, SIGNAL(triggered()), this, SLOT(deleteChatHistory())); connect(ui->actionMessageHistory, SIGNAL(triggered()), this, SLOT(messageHistory())); connect(ui->actionChooseFont, SIGNAL(triggered()), this, SLOT(chooseFont())); connect(ui->actionResetFont, SIGNAL(triggered()), this, SLOT(resetFont())); connect(ui->hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>))); connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&, int)), this, SLOT(updateStatus(const QString&, int))); connect(NotifyQt::getInstance(), SIGNAL(peerHasNewCustomStateString(const QString&, const QString&)), this, SLOT(updatePeersCustomStateString(const QString&, const QString&))); connect(ui->textBrowser, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuTextBrowser(QPoint))); connect(ui->chatTextEdit, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint))); // reset text and color after removing all characters from the QTextEdit and after calling QTextEdit::clear connect(ui->chatTextEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(chatCharFormatChanged())); ui->infoFrame->setVisible(false); ui->statusMessageLabel->hide(); setAcceptDrops(true); ui->chatTextEdit->setAcceptDrops(false); ui->hashBox->setDropWidget(this); ui->hashBox->setAutoHide(true); QMenu *menu = new QMenu(); menu->addAction(ui->actionChooseFont); menu->addAction(ui->actionResetFont); ui->fontButton->setMenu(menu); menu = new QMenu(); menu->addAction(ui->actionClearChatHistory); menu->addAction(ui->actionDeleteChatHistory); menu->addAction(ui->actionSaveChatHistory); menu->addAction(ui->actionMessageHistory); ui->pushtoolsButton->setMenu(menu); ui->chatTextEdit->installEventFilter(this); //#if QT_VERSION < 0x040700 // embedded images are not supported before QT 4.7.0 ui->attachPictureButton->setVisible(false); //#endif resetStatusBar(); }
int RunCommand(char *szCMD, int iFromAutorun) { // return 0: should run server sided command. // return 1: found local command. // return 2: local command not found. // return 3: exit process. if(szCMD[0] == 0x00) return 2; if(settings.iConsole) memset(&szCMD[(strlen(szCMD) - 2)], 0, 2); if(settings.runMode == RUNMODE_RCON) { if(!strncmp(szCMD, "login", 5) || !strncmp(szCMD, "LOGIN", 5)) { char *pszPass = &szCMD[6]; strcpy(settings.szRCONPass, pszPass); sendRconCommand(pszPass, 1); settings.iRCONLoggedIn = 1; Log("RCON password set."); } else { if(settings.iRCONLoggedIn) sendRconCommand(szCMD, 0); else Log("RCON password was not set. Type login [password]"); } return 1; } if(szCMD[0] != '!') { // SERVER CHAT OR COMMAND if(szCMD[0] == '/') sendServerCommand(szCMD); else sendChat(szCMD); return 0; } szCMD++; // EXIT if(!strncmp(szCMD, "exit", 4) || !strncmp(szCMD, "EXIT", 4) || !strncmp(szCMD, "quit", 4) || !strncmp(szCMD, "QUIT", 4)) { sampDisconnect(0); ExitProcess(0); return 3; } // RECONNECT if(!strncmp(szCMD, "reconnect", 9) || !strncmp(szCMD, "RECONNECT", 9)) { sampDisconnect(0); resetPools(1, 2000); return 1; } // RELOAD SETTINGS if(!strncmp(szCMD, "reload", 6) || !strncmp(szCMD, "RELOAD", 6)) { ReloadSettings(); return 1; } // SET RUNMODE if(!strncmp(szCMD, "runmode", 7) || !strncmp(szCMD, "RUNMODE", 7)) { int iRunModeID = atoi(&szCMD[8]); if(iRunModeID > 0 && iRunModeID < 6) { settings.runMode = (eRunModes)iRunModeID; Log("Runmode set to %d.", settings.runMode); } return 1; } // PLAYER LIST if(!strncmp(szCMD, "players", 7) || !strncmp(szCMD, "PLAYERS", 7)) { int iPlayerCount = 0; Log(" "); Log("============ PLAYER LIST ============"); for(int i = 0; i < MAX_PLAYERS; i++) { if(!playerInfo[i].iIsConnected) continue; Log("(ID: %d) %s - score: %d, ping: %d", i, playerInfo[i].szPlayerName, playerInfo[i].iScore, playerInfo[i].dwPing); iPlayerCount++; } Log(" "); Log("Count: %d.", iPlayerCount); Log("================================="); Log(" "); return 1; } // GOTO if(!strncmp(szCMD, "goto", 4) || !strncmp(szCMD, "GOTO", 4)) { // TELEPORT TO THE CURRENT CHECKPOINT if(!strncmp(szCMD, "gotocp", 6) || !strncmp(szCMD, "GOTOCP", 6)) { if(settings.CurrentCheckpoint.bActive) { if(settings.runMode != RUNMODE_NORMAL) { Log("[GOTOCP] You need to be in normal runmode to teleport into the checkpoint."); return 1; } settings.fNormalModePos[0] = settings.CurrentCheckpoint.fPosition[0]; settings.fNormalModePos[1] = settings.CurrentCheckpoint.fPosition[1]; settings.fNormalModePos[2] = settings.CurrentCheckpoint.fPosition[2]; Log("[GOTOCP] You have been teleported to the active checkpoint."); } else Log("[GOTOCP] There is no active checkpoint."); return 1; } int iPlayerID = atoi(&szCMD[5]); if(strlen(szCMD) == 4) { Log("[USAGE] !goto <PlayerID>"); return 1; } if(iPlayerID < 0 || iPlayerID > MAX_PLAYERS) return 1; if(playerInfo[iPlayerID].iIsConnected) { settings.fNormalModePos[0] = playerInfo[iPlayerID].onfootData.vecPos[0]; settings.fNormalModePos[1] = playerInfo[iPlayerID].onfootData.vecPos[1]; settings.fNormalModePos[2] = playerInfo[iPlayerID].onfootData.vecPos[2]; Log("[GOTO] Teleported to %s.", playerInfo[iPlayerID].szPlayerName); } else Log("[GOTO] Player %d is not connected.", iPlayerID); return 1; } // IMITATE if(!strncmp(szCMD, "imitate", 7) || !strncmp(szCMD, "IMITATE", 7)) { char *szPlayerName = &szCMD[8]; if(!strcmp(szPlayerName,"-1")) { imitateID = -1; Log("[IMITATE] Imitate was disabled."); return 1; } PLAYERID playerID = getPlayerIDFromPlayerName(szPlayerName); if(playerID < 0 || playerID > MAX_PLAYERS) return 1; if(playerInfo[playerID].iIsConnected) { imitateID = (PLAYERID)playerID; Log("[IMITATE] Imitate ID set to %d (%s)", imitateID, szPlayerName); } else Log("[IMITATE] Player %s is not connected.", szPlayerName); return 1; } // VEHICLE LIST if(!strncmp(szCMD, "vlist", 5) || !strncmp(szCMD, "VLIST", 5)) { for(VEHICLEID i = 0; i < MAX_VEHICLES; i++) { if(!vehiclePool[i].iDoesExist) continue; const struct vehicle_entry *vehicle = gta_vehicle_get_by_id( vehiclePool[i].iModelID ); if(vehicle) Log("[VLIST] %d (%s)", i, vehicle->name); } return 1; } // SEND VEHICLE DEATH NOTIFICATION if(!strncmp(szCMD, "vdeath", 6) || !strncmp(szCMD, "VDEATH", 6)) { int iSelectedVeh = atoi(&szCMD[7]); NotifyVehicleDeath((VEHICLEID)iSelectedVeh); Log("[VDEATH] Sent to vehicle ID %d", iSelectedVeh); return 1; } // SEND LOST CONNECTION PACKET TO THE SERVER if(!strncmp(szCMD, "fu", 2) || !strncmp(szCMD, "fu", 2)) { RakNet::BitStream bs; bs.Write((BYTE)ID_CONNECTION_LOST); pRakClient->Send(&bs, HIGH_PRIORITY, UNRELIABLE_SEQUENCED, 0); return 1; } // SELECT AN ITEM FROM THE GTA MENU if(!strncmp(szCMD, "menusel", 7) || !strncmp(szCMD, "MENUSEL", 7)) { BYTE bRow = (BYTE)atoi(&szCMD[8]); if(bRow != 0xFF) { RakNet::BitStream bsSend; bsSend.Write(bRow); pRakClient->RPC(&RPC_MenuSelect, &bsSend, HIGH_PRIORITY, RELIABLE, 0, FALSE, UNASSIGNED_NETWORK_ID, NULL); } return 1; } // FAKE KILL :-) if(!strncmp(szCMD, "kill", 4) || !strncmp(szCMD, "KILL", 4)) { if(!settings.bFakeKill) { Log("Started flooding.. :-)"); settings.bFakeKill = true; }else{ settings.bFakeKill = false; Log("Stopped flooding."); } return 1; } // LAG :-) if(!strncmp(szCMD, "lag", 4) || !strncmp(szCMD, "LAG", 4)) { if(!settings.bLag) { Log("Started lagging.. :-)"); settings.bLag=true; }else{ settings.bLag=false; Log("Stopped lagging."); } return 1; } // SPAM :-) if(!strncmp(szCMD, "spam", 4) || !strncmp(szCMD, "SPAM", 4)) { if (settings.bSpam) { Log("Stopped spamming."); settings.bSpam = false; }else{ Log("Started spamming.."); settings.bSpam = true; } return 1; } // REQUEST CLASS if(!strncmp(szCMD, "class", 5) || !strncmp(szCMD, "CLASS", 5)) { sampRequestClass(atoi(&szCMD[6])); return 1; } // SPAWNS THE FAKE PLAYER if(!strncmp(szCMD, "spawn", 5) || !strncmp(szCMD, "SPAWN", 5)) { sampSpawn(); iSpawned = 1; return 1; } // SEND WE PICKED UP A PICKUP :-) if(!strncmp(szCMD, "pickup", 6) || !strncmp(szCMD, "PICKUP", 6)) { int iPickupID = atoi(&szCMD[7]); sendPickUp(iPickupID); Log("Picked up ID %d pickup.", iPickupID); return 1; } // PULSE HEALTH & ARMOR if(!strncmp(szCMD, "pulsehealth", 11) || !strncmp(szCMD, "PULSEHEALTH", 11)) { if (settings.pulseHealth) { Log("Stopped health pulser."); settings.pulseHealth = false; settings.fPlayerHealth = settings.fHealthBeforePulse; settings.fPlayerArmour = settings.fArmourBeforePulse; } else { settings.fHealthBeforePulse = settings.fPlayerHealth; settings.fArmourBeforePulse = settings.fPlayerArmour; Log("Started health pulser..."); settings.pulseHealth = true; } return 1; } // SET THE FAKE PLAYER'S CURRENT WEAPON if(!strncmp(szCMD, "weapon", 6) || !strncmp(szCMD, "WEAPON", 6)) { settings.bCurrentWeapon = (BYTE)atoi(&szCMD[7]); Log("Client's current weapon set to %d.", settings.bCurrentWeapon); return 1; } // SET THE FOLLOWED PLAYER'S NAME if(!strncmp(szCMD, "selplayer", 9) || !strncmp(szCMD, "SELPLAYER", 9)) { char *szPlayerName = &szCMD[10]; sprintf_s(settings.szFollowingPlayerName, 20, szPlayerName); settings.runMode = RUNMODE_FOLLOWPLAYER; Log("[SELPLAYER] Following player changed to %s.", settings.szFollowingPlayerName); return 1; } // SET THE FAKE PLAYER'S VEHICLE if(!strncmp(szCMD, "selveh", 6) || !strncmp(szCMD, "SELVEH", 6)) { int iSelectedVeh = atoi(&szCMD[7]); if(settings.runMode == RUNMODE_FOLLOWPLAYERSVEHICLE) settings.iFollowingWithVehicleID = (VEHICLEID)iSelectedVeh; Log("[SELVEH] Changed to vehicle ID to %d.", iSelectedVeh); return 1; } // CHANGE FOLLOWING OFFSET (X) if(!strncmp(szCMD, "follow_x", 8) || !strncmp(szCMD, "follow_X", 8) || !strncmp(szCMD, "FOLLOW_X", 8)) { settings.fFollowXOffset = (float)atof(&szCMD[9]); return 1; } // CHANGE FOLLOWING OFFSET (Y) if(!strncmp(szCMD, "follow_y", 8) || !strncmp(szCMD, "follow_Y", 8) || !strncmp(szCMD, "FOLLOW_Y", 8)) { settings.fFollowYOffset = (float)atof(&szCMD[9]); return 1; } // CHANGE FOLLOWING OFFSET (Z) if(!strncmp(szCMD, "follow_z", 8) || !strncmp(szCMD, "follow_Z", 8) || !strncmp(szCMD, "FOLLOW_Z", 8)) { settings.fFollowZOffset = (float)atof(&szCMD[9]); return 1; } // SEND BULLETS TO PLAYERS' POSITION :-) if(!strncmp(szCMD, "bulletflood", 11) || !strncmp(szCMD, "BULLETFLOOD", 11)) { if (settings.bulletFlood) { Log("Stopped bullet flooding."); settings.bulletFlood = false; } else { Log("Started bullet flooding..."); settings.bulletFlood = true; } return 1; } // CHANGE NAME AND REJOIN GAME :-) if(!strncmp(szCMD, "changename", 10) || !strncmp(szCMD, "CHANGENAME", 10)) { char *szNewPlayerName = &szCMD[11]; if(strlen(szCMD) > 11 && strcmp(g_szNickName, szNewPlayerName) != 0) { sprintf_s(g_szNickName, 32, szNewPlayerName); int iVersion = NETGAME_VERSION; unsigned int uiClientChallengeResponse = settings.uiChallange ^ iVersion; BYTE byteMod = 1; char auth_bs[4*16] = {0}; gen_gpci(auth_bs, 0x3e9); BYTE byteAuthBSLen; byteAuthBSLen = (BYTE)strlen(auth_bs); BYTE byteNameLen = (BYTE)strlen(g_szNickName); BYTE iClientVerLen = (BYTE)strlen(settings.szClientVersion); RakNet::BitStream bsSend; bsSend.Write(iVersion); bsSend.Write(byteMod); bsSend.Write(byteNameLen); bsSend.Write(g_szNickName, byteNameLen); bsSend.Write(uiClientChallengeResponse); bsSend.Write(byteAuthBSLen); bsSend.Write(auth_bs, byteAuthBSLen); bsSend.Write(iClientVerLen); bsSend.Write(settings.szClientVersion, iClientVerLen); pRakClient->RPC(&RPC_ClientJoin, &bsSend, HIGH_PRIORITY, RELIABLE, 0, FALSE, UNASSIGNED_NETWORK_ID, NULL); iAreWeConnected = 1; Log("Changed name to %s and rejoined to the game.", g_szNickName); } return 1; } // AUTOMATIC CHECKPOINT TELEPORTER if(!strncmp(szCMD, "autogotocp", 10) || !strncmp(szCMD, "AUTOGOTOCP", 10)) { if (settings.AutoGotoCP) { Log("Stopped automatic checkpoint teleporter."); settings.AutoGotoCP = false; } else { Log("Started automatic checkpoint teleporter..."); settings.AutoGotoCP = true; } return 1; } // CHANGE POSITION (X) if(!strncmp(szCMD, "pos_x", 5) || !strncmp(szCMD, "pos_X", 5) || !strncmp(szCMD, "POS_X", 5)) { settings.fNormalModePos[0] = (float)atof(&szCMD[6]); return 1; } // CHANGE POSITION (Y) if(!strncmp(szCMD, "pos_y", 5) || !strncmp(szCMD, "pos_Y", 5) || !strncmp(szCMD, "POS_Y", 5)) { settings.fNormalModePos[1] = (float)atof(&szCMD[6]); return 1; } // CHANGE POSITION (Z) if(!strncmp(szCMD, "pos_z", 5) || !strncmp(szCMD, "pos_Z", 5) || !strncmp(szCMD, "POS_Z", 5)) { settings.fNormalModePos[2] = (float)atof(&szCMD[6]); return 1; } // SEND DIALOG RESPONSE :-) if(!strncmp(szCMD, "dialogresponse", 14) || !strncmp(szCMD, "DIALOGRESPONSE", 14)) { char szDialogID[10], szButtonID[10], szListBoxItem[10], szInputResp[128]; if(sscanf(&szCMD[15], "%s%s%s%s", szDialogID, szButtonID, szListBoxItem, szInputResp) < 4) { Log("USAGE: !dialogresponse <Dialog ID> <Button ID> <Listbox item> <Input response>"); return 1; } sendDialogResponse(atoi(szDialogID), atoi(szButtonID), atoi(szListBoxItem), szInputResp); Log("Dialog response sent."); return 1; } Log("Command %s was not found.", szCMD); return 2; }