diff options
author | Otto Allmendinger <oallmendinger@users.sourceforge.net> | 2011-04-02 23:16:23 +0400 |
---|---|---|
committer | Stefan Hacker <dd0t@users.sourceforge.net> | 2011-04-08 04:38:31 +0400 |
commit | 1d832d56ff0db9ccc7868d634759a1e91b46bc7d (patch) | |
tree | 4c40fab23536224180fd48ce624cccc8dd6b7f9a /src/murmur/MurmurIce.cpp | |
parent | 6f156fa460e8a67fdb0372c81501359a5fee2efd (diff) |
Text Message Callback with Ice
Diffstat (limited to 'src/murmur/MurmurIce.cpp')
-rw-r--r-- | src/murmur/MurmurIce.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/murmur/MurmurIce.cpp b/src/murmur/MurmurIce.cpp index f8e07d5e1..a15760793 100644 --- a/src/murmur/MurmurIce.cpp +++ b/src/murmur/MurmurIce.cpp @@ -177,6 +177,24 @@ static void infoToInfo(const Murmur::UserInfoMap &im, QMap<int, QString> &info) info.insert((*i).first, u8((*i).second)); } +static void textmessageToTextmessage(const ::TextMessage &tm, Murmur::TextMessage &tmdst) { + tmdst.text = u8(tm.text); + + QList<int>::const_iterator i; + + for (i = tm.sessions.begin(); i != tm.sessions.end(); ++i) { + tmdst.sessions.push_back(*i); + } + + for (i = tm.channels.begin(); i != tm.channels.end(); ++i) { + tmdst.channels.push_back(*i); + } + + for (i = tm.trees.begin(); i != tm.trees.end(); ++i) { + tmdst.trees.push_back(*i); + } +} + class ServerLocator : public virtual Ice::ServantLocator { public: virtual Ice::ObjectPtr locate(const Ice::Current &, Ice::LocalObjectPtr &); @@ -374,6 +392,29 @@ void MurmurIce::userStateChanged(const ::User *p) { } } +void MurmurIce::userTextMessage(const ::User *p, const ::TextMessage &message) { + ::Server *s = qobject_cast< ::Server *> (sender()); + + const QList< ::Murmur::ServerCallbackPrx> &qmList = qmServerCallbacks[s->iServerNum]; + + if (qmList.isEmpty()) + return; + + ::Murmur::User mp; + userToUser(p, mp); + + ::Murmur::TextMessage textMessage; + textmessageToTextmessage(message, textMessage); + + foreach(const ::Murmur::ServerCallbackPrx &prx, qmList) { + try { + prx->userTextMessage(mp, textMessage); + } catch (...) { + badServerProxy(prx, s->iServerNum); + } + } +} + void MurmurIce::channelCreated(const ::Channel *c) { ::Server *s = qobject_cast< ::Server *> (sender()); |