Store context

This commit is contained in:
Thorvald Natvig 2009-04-20 02:55:57 +02:00
parent 4ef52e99eb
commit 6ec2d36cba
5 changed files with 22 additions and 2 deletions

View File

@ -69,6 +69,10 @@ inline QString u8(const ::std::string &str) {
return QString::fromUtf8(str.data(), str.length());
}
inline QString u8(const ::std::wstring &str) {
return QString::fromStdWString(str);
}
inline ::std::string u8(const QString &str) {
const QByteArray &qba = str.toUtf8();
return ::std::string(qba.constData(), qba.length());

View File

@ -50,6 +50,8 @@ class Player {
bool bTalking, bAltSpeak;
Channel *cChannel;
QByteArray qbaTexture;
std::string ssContext;
QString qsIdentity;
QString getFlagsString() const;
Player();

View File

@ -221,6 +221,10 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) {
pDst->qbaTexture = QByteArray(str.data(), str.size());
g.o->verifyTexture(pDst);
}
if (msg.has_plugin_context()) {
QMutexLocker qml(&g.p->qmPlugins);
pDst->ssContext = msg.plugin_context();
}
}
void MainWindow::msgUserRemove(const MumbleProto::UserRemove &msg) {

View File

@ -62,11 +62,11 @@ class Plugins : public QObject {
Q_OBJECT
Q_DISABLE_COPY(Plugins)
protected:
QMutex qmPlugins;
QList<PluginInfo *> qlPlugins;
PluginInfo *locked;
PluginInfo *prevlocked;
public:
QMutex qmPlugins;
std::string ssContext, ssContextSent;
std::wstring swsIdentity, swsIdentitySent;
bool bValid;

View File

@ -242,6 +242,8 @@ void Server::msgAuthenticate(User *uSource, MumbleProto::Authenticate &msg) {
else if (u->bSelfMute)
mpus.set_self_mute(true);
if (! u->ssContext.empty())
mpus.set_plugin_context(u->ssContext);
sendMessage(uSource, mpus);
}
@ -356,7 +358,7 @@ void Server::msgUserState(User *uSource, MumbleProto::UserState &msg) {
}
}
if ((pDstUser != uSource) && (msg.has_self_deaf() || msg.has_self_mute() || msg.has_texture()))
if ((pDstUser != uSource) && (msg.has_self_deaf() || msg.has_self_mute() || msg.has_texture() || msg.has_plugin_context() || msg.has_plugin_identity()))
return;
// Permission checks done. Now enact this.
@ -374,7 +376,15 @@ void Server::msgUserState(User *uSource, MumbleProto::UserState &msg) {
uSource->bSelfDeaf = false;
}
}
if (msg.has_plugin_context()) {
uSource->ssContext = msg.plugin_context();
}
if (msg.has_plugin_identity()) {
uSource->qsIdentity = u8(msg.plugin_identity());
msg.clear_plugin_identity();
}
if (msg.has_channel_id()) {
Channel *c = qhChannels.value(msg.channel_id());