diff options
-rw-r--r-- | src/Message.cpp | 8 | ||||
-rw-r--r-- | src/Message.h | 2 | ||||
-rw-r--r-- | src/mumble/MainWindow.cpp | 67 | ||||
-rw-r--r-- | src/mumble/MainWindow.h | 2 | ||||
-rw-r--r-- | src/mumble/MainWindow.ui | 25 | ||||
-rw-r--r-- | src/mumble/mumble.pro | 6 |
6 files changed, 101 insertions, 9 deletions
diff --git a/src/Message.cpp b/src/Message.cpp index 3cc32db66..05cd79cf7 100644 --- a/src/Message.cpp +++ b/src/Message.cpp @@ -44,12 +44,12 @@ void Message::messageToNetwork(QByteArray &qbaOut) const { qdsOut << messageType(); qdsOut << uiSession; saveStream(qdsOut); - + if (qdsOut.undersize() == 0) { qbaOut = QByteArray(buffer, qdsOut.size()); return; } - + unsigned int size = 8192 + qdsOut.undersize(); char b[size]; PacketDataStream pdsResized(b, size); @@ -509,11 +509,15 @@ void MessageChannelRename::restoreStream(PacketDataStream &qdsIn) { void MessageTextMessage::saveStream(PacketDataStream &qdsOut) const { qdsOut << uiVictim; + qdsOut << iChannel; + qdsOut << bTree; qdsOut << qsMessage; } void MessageTextMessage::restoreStream(PacketDataStream &qdsIn) { qdsIn >> uiVictim; + qdsIn >> iChannel; + qdsIn >> bTree; qdsIn >> qsMessage; } diff --git a/src/Message.h b/src/Message.h index f618c552e..18d79c9ff 100644 --- a/src/Message.h +++ b/src/Message.h @@ -328,6 +328,8 @@ class MessageTextMessage : public Message { void restoreStream(PacketDataStream &); public: unsigned int uiVictim; + int iChannel; + bool bTree; QString qsMessage; Message::MessageType messageType() const { return TextMessage; diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp index 50dd64bee..b44e1289d 100644 --- a/src/mumble/MainWindow.cpp +++ b/src/mumble/MainWindow.cpp @@ -49,6 +49,7 @@ #include "Global.h" #include "Database.h" #include "ViewCert.h" +#include "TextMessage.h" MessageBoxEvent::MessageBoxEvent(QString m) : QEvent(static_cast<QEvent::Type>(MB_QEVENT)) { msg = m; @@ -434,16 +435,20 @@ void MainWindow::on_qaPlayerTextMessage_triggered() { short session = p->uiSession; - bool ok; - QString message = QInputDialog::getText(this, tr("Sending message to %1").arg(p->qsName), tr("Enter message"), QLineEdit::Normal, QString(), &ok); + TextMessage tm; + tm.setWindowTitle(tr("Sending message to %1").arg(p->qsName)); + int res = tm.exec(); + p = ClientPlayer::get(session); if (!p) return; - if (ok) { + if (res==QDialog::Accepted) { MessageTextMessage mtxt; + mtxt.iChannel = -1; + mtxt.bTree = false; mtxt.uiVictim = p->uiSession; - mtxt.qsMessage = message; + mtxt.qsMessage = tm.message(); g.l->log(Log::TextMessage, tr("To %1: %2").arg(p->qsName).arg(mtxt.qsMessage), tr("Message to %1").arg(p->qsName)); g.sh->sendMessage(&mtxt); } @@ -605,6 +610,60 @@ void MainWindow::on_qaChannelUnlinkAll_triggered() { g.sh->sendMessage(&mcl); } +void MainWindow::on_qaChannelSendMessage_triggered() { + Channel *c = pmModel->getChannel(qtvPlayers->currentIndex()); + + if (!c) + return; + + int id = c->iId; + + TextMessage tm; + tm.setWindowTitle(tr("Sending message to channel %1").arg(c->qsName)); + int res = tm.exec(); + + c = Channel::get(id); + if (!c) + return; + + if (res==QDialog::Accepted) { + MessageTextMessage mtxt; + mtxt.iChannel = id; + mtxt.bTree = false; + mtxt.uiVictim = 0; + mtxt.qsMessage = tm.message(); + g.l->log(Log::TextMessage, tr("To %1: %2").arg(c->qsName).arg(mtxt.qsMessage), tr("Message to %1").arg(c->qsName)); + g.sh->sendMessage(&mtxt); + } +} + +void MainWindow::on_qaChannelSendTreeMessage_triggered() { + Channel *c = pmModel->getChannel(qtvPlayers->currentIndex()); + + if (!c) + return; + + int id = c->iId; + + TextMessage tm; + tm.setWindowTitle(tr("Sending message to channel tree %1").arg(c->qsName)); + int res = tm.exec(); + + c = Channel::get(id); + if (!c) + return; + + if (res==QDialog::Accepted) { + MessageTextMessage mtxt; + mtxt.iChannel = id; + mtxt.bTree = true; + mtxt.uiVictim = 0; + mtxt.qsMessage = tm.message(); + g.l->log(Log::TextMessage, tr("To tree %1: %2").arg(c->qsName).arg(mtxt.qsMessage), tr("Message to tree %1").arg(c->qsName)); + g.sh->sendMessage(&mtxt); + } +} + void MainWindow::on_qaAudioReset_triggered() { AudioInputPtr ai = g.ai; if (ai) diff --git a/src/mumble/MainWindow.h b/src/mumble/MainWindow.h index 53b793d8f..9b9beb3ef 100644 --- a/src/mumble/MainWindow.h +++ b/src/mumble/MainWindow.h @@ -99,6 +99,8 @@ class MainWindow : public QMainWindow, public MessageHandler, public Ui::MainWin void on_qaChannelLink_triggered(); void on_qaChannelUnlink_triggered(); void on_qaChannelUnlinkAll_triggered(); + void on_qaChannelSendMessage_triggered(); + void on_qaChannelSendTreeMessage_triggered(); void on_qaAudioReset_triggered(); void on_qaAudioMute_triggered(); void on_qaAudioDeaf_triggered(); diff --git a/src/mumble/MainWindow.ui b/src/mumble/MainWindow.ui index 234ef9bbc..bf9dd61ac 100644 --- a/src/mumble/MainWindow.ui +++ b/src/mumble/MainWindow.ui @@ -79,6 +79,9 @@ <addaction name="qaChannelLink" /> <addaction name="qaChannelUnlink" /> <addaction name="qaChannelUnlinkAll" /> + <addaction name="separator" /> + <addaction name="qaChannelSendMessage" /> + <addaction name="qaChannelSendTreeMessage" /> </widget> <widget class="QMenu" name="qmAudio" > <property name="title" > @@ -504,6 +507,28 @@ <string>Connects to the Mumble webpage to check if a new version is available, and notifies you with an appropriate download URL if this is the case.</string> </property> </action> + <action name="qaChannelSendMessage" > + <property name="text" > + <string>Send Messa&ge</string> + </property> + <property name="toolTip" > + <string>Send a Text Message</string> + </property> + <property name="whatsThis" > + <string>Sends a text message to all users in a channel.</string> + </property> + </action> + <action name="qaChannelSendTreeMessage" > + <property name="text" > + <string>Send &Tree Message</string> + </property> + <property name="toolTip" > + <string>Send message to channel tree.</string> + </property> + <property name="whatsThis" > + <string>This sends a text message to a channel and it's subchannels.</string> + </property> + </action> </widget> <resources/> <connections/> diff --git a/src/mumble/mumble.pro b/src/mumble/mumble.pro index ccffa2799..9c3fb04aa 100644 --- a/src/mumble/mumble.pro +++ b/src/mumble/mumble.pro @@ -7,15 +7,15 @@ TARGET = mumble RC_FILE = mumble.rc HEADERS += SOURCES += -HEADERS = BanEditor.h ACLEditor.h Log.h AudioConfigDialog.h AudioStats.h AudioInput.h AudioOutput.h MainWindow.h ServerHandler.h About.h ConnectDialog.h GlobalShortcut.h TextToSpeech.h Settings.h Database.h VersionCheck.h Global.h PlayerModel.h Audio.h ConfigDialog.h Plugins.h LookConfig.h Overlay.h AudioWizard.h ViewCert.h DBus.h -SOURCES = BanEditor.cpp ACLEditor.cpp Log.cpp AudioConfigDialog.cpp AudioStats.cpp AudioInput.cpp AudioOutput.cpp main.cpp MainWindow.cpp ServerHandler.cpp About.cpp ConnectDialog.cpp Settings.cpp Database.cpp VersionCheck.cpp Global.cpp PlayerModel.cpp Audio.cpp ConfigDialog.cpp Plugins.cpp LookConfig.cpp Overlay.cpp AudioWizard.cpp ViewCert.cpp Messages.cpp DBus.cpp +HEADERS = BanEditor.h ACLEditor.h Log.h AudioConfigDialog.h AudioStats.h AudioInput.h AudioOutput.h MainWindow.h ServerHandler.h About.h ConnectDialog.h GlobalShortcut.h TextToSpeech.h Settings.h Database.h VersionCheck.h Global.h PlayerModel.h Audio.h ConfigDialog.h Plugins.h LookConfig.h Overlay.h AudioWizard.h ViewCert.h DBus.h TextMessage.h +SOURCES = BanEditor.cpp ACLEditor.cpp Log.cpp AudioConfigDialog.cpp AudioStats.cpp AudioInput.cpp AudioOutput.cpp main.cpp MainWindow.cpp ServerHandler.cpp About.cpp ConnectDialog.cpp Settings.cpp Database.cpp VersionCheck.cpp Global.cpp PlayerModel.cpp Audio.cpp ConfigDialog.cpp Plugins.cpp LookConfig.cpp Overlay.cpp AudioWizard.cpp ViewCert.cpp Messages.cpp DBus.cpp TextMessage.cpp HEADERS += ../ACL.h ../Group.h ../Channel.h ../Connection.h ../Player.h SOURCES += ../ACL.cpp ../Group.cpp ../Channel.cpp ../Message.cpp ../Connection.cpp ../Player.cpp ../Timer.cpp ../CryptState.cpp DIST += licenses.h mumble.ico firmumble.inc plugins/mumble_plugin.h mumble-overlay mumble.desktop INCLUDEPATH += ../../speex/include LIBS += -Llib -L. RESOURCES += mumble.qrc -FORMS += ConfigDialog.ui MainWindow.ui ConnectDialog.ui BanEditor.ui ACLEditor.ui Plugins.ui Overlay.ui LookConfig.ui AudioConfigDialog.ui Log.ui +FORMS += ConfigDialog.ui MainWindow.ui ConnectDialog.ui BanEditor.ui ACLEditor.ui Plugins.ui Overlay.ui LookConfig.ui AudioConfigDialog.ui Log.ui TextMessage.ui TRANSLATIONS = mumble_en.ts mumble_es.ts mumble_de.ts mumble_tr.ts mumble_id.ts mumble_fr.ts mumble_ru.ts mumble_it.ts mumble_pt.ts mumble_nb.ts mumble_nl.ts mumble_cs.ts |