diff options
-rw-r--r-- | src/mumble/Messages.cpp | 148 | ||||
-rw-r--r-- | src/mumble/mumble_en.ts | 50 |
2 files changed, 110 insertions, 88 deletions
diff --git a/src/mumble/Messages.cpp b/src/mumble/Messages.cpp index 4a9e18401..4a8cf4a71 100644 --- a/src/mumble/Messages.cpp +++ b/src/mumble/Messages.cpp @@ -262,18 +262,96 @@ void MainWindow::msgUDPTunnel(const MumbleProto::UDPTunnel &) { void MainWindow::msgUserState(const MumbleProto::UserState &msg) { ACTOR_INIT; SELF_INIT; - ClientUser *pDst = ClientUser::get(msg.session()); - bool bNewUser = false; - if (! pDst) { + Channel *channel = NULL; + if (msg.has_channel_id()) { + channel = Channel::get(msg.channel_id()); + if (!channel) { + qWarning("msgUserState(): unknown channel."); + channel = Channel::get(0); + } + } + + ClientUser *pDst = ClientUser::get(msg.session()); + if (!pDst) { if (msg.has_name()) { pDst = pmModel->addUser(msg.session(), u8(msg.name())); - bNewUser = true; + + if (channel) { + pmModel->moveUser(pDst, channel); + } + + if (pSelf && pDst->cChannel == pSelf->cChannel) { + g.l->log(Log::ChannelJoin, tr("%1 connected and entered channel.").arg(Log::formatClientUser(pDst, Log::Source))); + } else { + g.l->log(Log::UserJoin, tr("%1 connected.").arg(Log::formatClientUser(pDst, Log::Source))); + } } else { return; } } + if (channel) { + Channel *oldChannel = pDst->cChannel; + if (channel != oldChannel) { + pmModel->moveUser(pDst, channel); + + if (pSelf) { + if (pDst == pSelf) { + g.mw->updateChatBar(); + qsDesiredChannel = channel->getPath(); + } + + if (pDst == pSelf) { + if (pSrc == pSelf) { + g.l->log(Log::SelfChannelJoin, tr("You joined %1.").arg(Log::formatChannel(channel))); + } else { + g.l->log(Log::SelfChannelJoinOther, tr("You were moved to %1 by %2.").arg(Log::formatChannel(channel)).arg(Log::formatClientUser(pSrc, Log::Source))); + } + } else if ((channel == pSelf->cChannel) || oldChannel == pSelf->cChannel) { + if (pDst == pSrc) { + if (channel == pSelf->cChannel) { + g.l->log(Log::ChannelJoin, tr("%1 entered channel.").arg(Log::formatClientUser(pDst, Log::Target))); + } else { + g.l->log(Log::ChannelLeave, tr("%1 moved to %2.").arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatChannel(channel))); + } + } else if (pSrc == pSelf) { + if (channel == pSelf->cChannel) { + g.l->log(Log::ChannelJoin, tr("You moved %1 to %2.").arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatChannel(channel))); + } else { + g.l->log(Log::ChannelLeave, tr("You moved %1 to %2.").arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatChannel(channel))); + } + } else { + if (channel == pSelf->cChannel) { + g.l->log(Log::ChannelJoin, tr("%1 moved in from %2 by %3.").arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatChannel(oldChannel)).arg(Log::formatClientUser(pSrc, Log::Source))); + } else { + g.l->log(Log::ChannelLeave, tr("%1 moved to %2 by %3.").arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatChannel(channel)).arg(Log::formatClientUser(pSrc, Log::Source))); + } + } + } + + if ((channel == pSelf->cChannel) && pDst->bRecording) { + g.l->log(Log::Recording, tr("%1 is recording").arg(Log::formatClientUser(pDst, Log::Target))); + } + } + } + } + + if (msg.has_name()) { + QString oldName = pDst->qsName; + QString newName = u8(msg.name()); + pmModel->renameUser(pDst, newName); + if (! oldName.isNull() && oldName != newName) { + if (pSrc != pDst) { + g.l->log(Log::UserRenamed, tr("%1 renamed to %2 by %3.").arg(Log::formatClientUser(pDst, Log::Target, oldName)) + .arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatClientUser(pSrc, Log::Source))); + } else { + g.l->log(Log::UserRenamed, tr("%1 renamed to %2.").arg(Log::formatClientUser(pDst, Log::Target, oldName), + Log::formatClientUser(pDst, Log::Target))); + } + } + } + if (msg.has_user_id()) pmModel->setUserId(pDst, msg.user_id()); @@ -289,9 +367,6 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) { pDst->fLocalVolume = g.db->getUserLocalVolume(pDst->qsHash); } - if (bNewUser) - g.l->log(Log::UserJoin, tr("%1 connected.").arg(Log::formatClientUser(pDst, Log::Source))); - if (msg.has_self_deaf() || msg.has_self_mute()) { if (msg.has_self_mute()) pDst->setSelfMute(msg.self_mute()); @@ -299,7 +374,6 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) { pDst->setSelfDeaf(msg.self_deaf()); if (pSelf && pDst != pSelf && ((pDst->cChannel == pSelf->cChannel) || pDst->cChannel->allLinks().contains(pSelf->cChannel))) { - QString name = pDst->qsName; if (pDst->bSelfMute && pDst->bSelfDeaf) g.l->log(Log::OtherSelfMute, tr("%1 is now muted and deafened.").arg(Log::formatClientUser(pDst, Log::Target))); else if (pDst->bSelfMute) @@ -466,64 +540,6 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) { } } - if (msg.has_channel_id()) { - Channel *c = Channel::get(msg.channel_id()); - if (!c) { - qWarning("MessageUserMove for unknown channel."); - c = Channel::get(0); - } - - Channel *old = pDst->cChannel; - if (c != old) { - if (pSelf) { - if (pDst == pSelf) { - if (pSrc == pSelf) - g.l->log(Log::SelfChannelJoin, tr("You joined %1.").arg(Log::formatChannel(c))); - else - g.l->log(Log::SelfChannelJoinOther, tr("You were moved to %1 by %2.").arg(Log::formatChannel(c)).arg(Log::formatClientUser(pSrc, Log::Source))); - } else if (pDst->cChannel == pSelf->cChannel) { - if (pDst == pSrc) - g.l->log(Log::ChannelLeave, tr("%1 moved to %2.").arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatChannel(c))); - else - g.l->log(Log::ChannelLeave, tr("%1 moved to %2 by %3.").arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatChannel(c)).arg(Log::formatClientUser(pSrc, Log::Source))); - } else if (pSrc == pSelf) { - g.l->log(Log::ChannelJoin, tr("You moved %1 to %2.").arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatChannel(c))); - } - } - - pmModel->moveUser(pDst, c); - - if (pDst == pSelf) { - g.mw->updateChatBar(); - qsDesiredChannel = c->getPath(); - } - - bool log = pSelf && !((pDst == pSelf) && (pSrc == pSelf)); - if (log && (pDst != pSelf) && (pDst->cChannel == pSelf->cChannel)) { - if (pDst == pSrc) - g.l->log(Log::ChannelJoin, tr("%1 entered channel.").arg(Log::formatClientUser(pDst, Log::Target))); - else - g.l->log(Log::ChannelJoin, tr("%1 moved in from %2 by %3.").arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatChannel(old)).arg(Log::formatClientUser(pSrc, Log::Source))); - - if (pDst->bRecording) - g.l->log(Log::Recording, tr("%1 is recording").arg(Log::formatClientUser(pDst, Log::Target))); - } - } - } - if (msg.has_name()) { - QString oldName = pDst->qsName; - QString newName = u8(msg.name()); - pmModel->renameUser(pDst, newName); - if (! oldName.isNull() && oldName != newName) { - if (pSrc != pDst) { - g.l->log(Log::UserRenamed, tr("%1 renamed to %2 by %3.").arg(Log::formatClientUser(pDst, Log::Target, oldName)) - .arg(Log::formatClientUser(pDst, Log::Target)).arg(Log::formatClientUser(pSrc, Log::Source))); - } else { - g.l->log(Log::UserRenamed, tr("%1 renamed to %2.").arg(Log::formatClientUser(pDst, Log::Target, oldName), - Log::formatClientUser(pDst, Log::Target))); - } - } - } if (msg.has_texture_hash()) { pDst->qbaTextureHash = blob(msg.texture_hash()); pDst->qbaTexture = QByteArray(); diff --git a/src/mumble/mumble_en.ts b/src/mumble/mumble_en.ts index bf21c03fb..19d83dd0a 100644 --- a/src/mumble/mumble_en.ts +++ b/src/mumble/mumble_en.ts @@ -5878,7 +5878,7 @@ Otherwise abort and check your certificate and username.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="Messages.cpp" line="+334"/> + <location filename="Messages.cpp" line="+408"/> <source>You muted and deafened %1.</source> <translation type="unfinished"></translation> </message> @@ -5918,27 +5918,27 @@ Otherwise abort and check your certificate and username.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+26"/> + <location line="-218"/> <source>%1 moved to %2.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+2"/> + <location line="+12"/> <source>%1 moved to %2 by %3.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+18"/> + <location line="-2"/> <source>%1 moved in from %2 by %3.</source> <translation type="unfinished"></translation> </message> <message> - <location line="-202"/> + <location line="+52"/> <source>%1 is now muted and deafened.</source> <translation type="unfinished"></translation> </message> <message> - <location line="-222"/> + <location line="-296"/> <source>Your account information can not be verified currently. Please try again later</source> <translation type="unfinished"></translation> </message> @@ -6024,12 +6024,17 @@ Otherwise abort and check your certificate and username.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+40"/> + <location line="+32"/> + <source>%1 connected and entered channel.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location line="+2"/> <source>%1 connected.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+13"/> + <location line="+93"/> <source>%1 is now muted.</source> <translation type="unfinished"></translation> </message> @@ -6140,27 +6145,28 @@ Otherwise abort and check your certificate and username.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+75"/> + <location line="-173"/> <source>You joined %1.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+9"/> + <location line="+13"/> + <location line="+2"/> <source>You moved %1 to %2.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+19"/> + <location line="+12"/> <source>%1 is recording</source> <translation type="unfinished"></translation> </message> <message> - <location line="+10"/> + <location line="+12"/> <source>%1 renamed to %2 by %3.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+51"/> + <location line="+240"/> <source>%1 disconnected.</source> <translation type="unfinished"></translation> </message> @@ -6217,7 +6223,7 @@ Otherwise abort and check your certificate and username.</source> <translation type="unfinished"></translation> </message> <message> - <location line="-519"/> + <location line="-461"/> <source>You were unmuted by %1.</source> <translation type="unfinished"></translation> </message> @@ -6252,18 +6258,18 @@ Otherwise abort and check your certificate and username.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+422"/> + <location line="+364"/> <source>Unable to find matching CELT codecs with other clients. You will not be able to talk to all users.</source> <translation type="unfinished"></translation> </message> <message> - <location line="-488"/> + <location line="-430"/> <source>You were muted and deafened by %1.</source> <oldsource>You were deafened by %1.</oldsource> <translation type="unfinished"></translation> </message> <message> - <location line="+178"/> + <location line="+120"/> <source>You were kicked from the server by %1: %2.</source> <translation type="unfinished"></translation> </message> @@ -6283,17 +6289,17 @@ Otherwise abort and check your certificate and username.</source> <translation type="unfinished"></translation> </message> <message> - <location line="-80"/> + <location line="-270"/> <source>You were moved to %1 by %2.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+21"/> + <location line="+5"/> <source>%1 entered channel.</source> <translation type="unfinished"></translation> </message> <message> - <location line="-415"/> + <location line="-225"/> <source>Server connection rejected: %1.</source> <translation type="unfinished"></translation> </message> @@ -6303,12 +6309,12 @@ Otherwise abort and check your certificate and username.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+271"/> + <location line="+98"/> <source>%1 renamed to %2.</source> <translation type="unfinished"></translation> </message> <message> - <location line="+46"/> + <location line="+235"/> <source>%1 left channel and disconnected.</source> <translation type="unfinished"></translation> </message> |