History

remove xmpp chat support

Stephen Birarda committed 11 years ago

Commit e43da001 parent eb8e8e914 files · +4 −956Browse files

Showing the changes to interface/src/scripting/GlobalServicesScriptingInterface.cpp (1 of 14 files). Show all

Unified · Split

interface/src/scripting/GlobalServicesScriptingInterface.cpp+0−80
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212 #include "AccountManager.h"
1313 #include "Application.h"
1414 #include "ResourceCache.h"
15−#include "XmppClient.h"
1615
1716 #include "GlobalServicesScriptingInterface.h"
1817
@@ -20,13 +19,6 @@ GlobalServicesScriptingInterface::GlobalServicesScriptingInterface() { · 1 unmodified line
2019 AccountManager& accountManager = AccountManager::getInstance();
2120 connect(&accountManager, &AccountManager::usernameChanged, this, &GlobalServicesScriptingInterface::myUsernameChanged);
2221 connect(&accountManager, &AccountManager::logoutComplete, this, &GlobalServicesScriptingInterface::loggedOut);
23−#ifdef HAVE_QXMPP
24− const XmppClient& xmppClient = XmppClient::getInstance();
25− connect(&xmppClient, &XmppClient::joinedPublicChatRoom, this, &GlobalServicesScriptingInterface::connected);
26− connect(&xmppClient, &XmppClient::joinedPublicChatRoom, this, &GlobalServicesScriptingInterface::onConnected);
27− const QXmppClient& qxmppClient = XmppClient::getInstance().getXMPPClient();
28− connect(&qxmppClient, &QXmppClient::messageReceived, this, &GlobalServicesScriptingInterface::messageReceived);
29−#endif // HAVE_QXMPP
3022
3123 _downloading = false;
3224 connect(Application::getInstance(), &Application::renderingInWorldInterface,
@@ -37,30 +29,6 @@ GlobalServicesScriptingInterface::~GlobalServicesScriptingInterface() { · 4 unmodified lines
3729 AccountManager& accountManager = AccountManager::getInstance();
3830 disconnect(&accountManager, &AccountManager::usernameChanged, this, &GlobalServicesScriptingInterface::myUsernameChanged);
3931 disconnect(&accountManager, &AccountManager::logoutComplete, this, &GlobalServicesScriptingInterface::loggedOut);
40−#ifdef HAVE_QXMPP
41− const XmppClient& xmppClient = XmppClient::getInstance();
42− disconnect(&xmppClient, &XmppClient::joinedPublicChatRoom, this, &GlobalServicesScriptingInterface::connected);
43− disconnect(&xmppClient, &XmppClient::joinedPublicChatRoom, this, &GlobalServicesScriptingInterface::onConnected);
44− const QXmppClient& qxmppClient = XmppClient::getInstance().getXMPPClient();
45− disconnect(&qxmppClient, &QXmppClient::messageReceived, this, &GlobalServicesScriptingInterface::messageReceived);
46− const QXmppMucRoom* publicChatRoom = XmppClient::getInstance().getPublicChatRoom();
47− disconnect(publicChatRoom, &QXmppMucRoom::participantsChanged,
48− this, &GlobalServicesScriptingInterface::participantsChanged);
49−#endif // HAVE_QXMPP
50−}
51−
52−void GlobalServicesScriptingInterface::onConnected() {
53−#ifdef HAVE_QXMPP
54− const QXmppMucRoom* publicChatRoom = XmppClient::getInstance().getPublicChatRoom();
55− connect(publicChatRoom, &QXmppMucRoom::participantsChanged,
56− this, &GlobalServicesScriptingInterface::participantsChanged, Qt::UniqueConnection);
57−#endif // HAVE_QXMPP
58−}
59−
60−void GlobalServicesScriptingInterface::participantsChanged() {
61−#ifdef HAVE_QXMPP
62− emit GlobalServicesScriptingInterface::onlineUsersChanged(this->getOnlineUsers());
63−#endif // HAVE_QXMPP
6432 }
6533
6634 GlobalServicesScriptingInterface* GlobalServicesScriptingInterface::getInstance() {
@@ -68,62 +36,14 @@ GlobalServicesScriptingInterface* GlobalServicesScriptingInterface::getInstance( · 1 unmodified line
6836 return &sharedInstance;
6937 }
7038
71−bool GlobalServicesScriptingInterface::isConnected() {
72−#ifdef HAVE_QXMPP
73− return XmppClient::getInstance().getXMPPClient().isConnected();
74−#else
75− return false;
76−#endif // HAVE_QXMPP
77−}
78−
79−QScriptValue GlobalServicesScriptingInterface::chat(const QString& message) {
80−#ifdef HAVE_QXMPP
81− if (XmppClient::getInstance().getXMPPClient().isConnected()) {
82− const QXmppMucRoom* publicChatRoom = XmppClient::getInstance().getPublicChatRoom();
83− QXmppMessage messageObject;
84− messageObject.setTo(publicChatRoom->jid());
85− messageObject.setType(QXmppMessage::GroupChat);
86− messageObject.setBody(message);
87− return XmppClient::getInstance().getXMPPClient().sendPacket(messageObject);
88− }
89−#endif // HAVE_QXMPP
90− return false;
91−}
92−
9339 QString GlobalServicesScriptingInterface::getMyUsername() {
9440 return AccountManager::getInstance().getAccountInfo().getUsername();
9541 }
9642
97−QStringList GlobalServicesScriptingInterface::getOnlineUsers() {
98−#ifdef HAVE_QXMPP
99− if (XmppClient::getInstance().getXMPPClient().isConnected()) {
100− QStringList usernames;
101− const QXmppMucRoom* publicChatRoom = XmppClient::getInstance().getPublicChatRoom();
102− foreach(const QString& participant, XmppClient::getInstance().getPublicChatRoom()->participants()) {
103− usernames.append(participant.right(participant.count() - 1 - publicChatRoom->jid().count()));
104− }
105− return usernames;
106− }
107−#endif // HAVE_QXMPP
108− return QStringList();
109−}
110−
11143 void GlobalServicesScriptingInterface::loggedOut() {
11244 emit GlobalServicesScriptingInterface::disconnected(QString("logout"));
11345 }
11446
115−#ifdef HAVE_QXMPP
116−void GlobalServicesScriptingInterface::messageReceived(const QXmppMessage& message) {
117− if (message.type() != QXmppMessage::GroupChat) {
118− return;
119− }
120− const QXmppMucRoom* publicChatRoom = XmppClient::getInstance().getPublicChatRoom();
121− QString username = message.from().right(message.from().count() - 1 - publicChatRoom->jid().count());
122− emit GlobalServicesScriptingInterface::incomingMessage(username, message.body());
123−}
124−#endif // HAVE_QXMPP
125−
126−
12747 DownloadInfoResult::DownloadInfoResult() :
12848 downloading(QList<float>()),
12949 pending(0.0f)