Files
@ ba5c6ce41e34
Branch filter:
Location: libtransport.git/backends/libcommuni/ircnetworkplugin.h - annotation
ba5c6ce41e34
2.5 KiB
text/plain
Cleanup libcommuni code a bit, fix the tests and PM receiving when it is initiated from IRC
addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a addac0040c4a bc3971f7d258 bc3971f7d258 ba5c6ce41e34 47b1db7f432c 78e71f9345c7 78e71f9345c7 bc3971f7d258 bc3971f7d258 bc3971f7d258 bc3971f7d258 47b1db7f432c bc3971f7d258 bc3971f7d258 bc3971f7d258 bc3971f7d258 bc3971f7d258 bc3971f7d258 bc3971f7d258 bc3971f7d258 bc3971f7d258 bc3971f7d258 bc3971f7d258 f7dc91ccb482 bc3971f7d258 bc3971f7d258 bc3971f7d258 bc3971f7d258 bc3971f7d258 eb1df41b3ea2 eb1df41b3ea2 0e56fb848472 0e56fb848472 bc3971f7d258 bc3971f7d258 bc3971f7d258 bc3971f7d258 05e06dd845ae 05e06dd845ae 05e06dd845ae 05e06dd845ae 05e06dd845ae bc3971f7d258 ba5c6ce41e34 bc3971f7d258 40dbe667beea 0e56fb848472 0e56fb848472 05e06dd845ae 8b6973539f23 bf012e48b2aa | /**
* XMPP - libpurple transport
*
* Copyright (C) 2013, Jan Kaluza <hanzz.k@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#pragma once
#ifndef Q_MOC_RUN
#include "transport/Config.h"
#include "transport/NetworkPlugin.h"
#include "session.h"
#include <QtCore>
#include <QtNetwork>
#include "Swiften/EventLoop/Qt/QtEventLoop.h"
#endif
class IRCNetworkPlugin : public QObject, public NetworkPlugin {
Q_OBJECT
public:
IRCNetworkPlugin(Config *config, Swift::QtEventLoop *loop, const std::string &host, int port);
void handleLoginRequest(const std::string &user, const std::string &legacyName, const std::string &password);
void handleLogoutRequest(const std::string &user, const std::string &legacyName);
void handleMessageSendRequest(const std::string &user, const std::string &legacyName, const std::string &message, const std::string &/*xhtml*/, const std::string &/*id*/);
void handleJoinRoomRequest(const std::string &user, const std::string &room, const std::string &nickname, const std::string &password);
void handleLeaveRoomRequest(const std::string &user, const std::string &room);
void handleRoomSubjectChangedRequest(const std::string &user, const std::string &room, const std::string &message);
void tryNextServer();
public slots:
void readData();
void sendData(const std::string &string);
private:
MyIrcSession *createSession(const std::string &user, const std::string &hostname, const std::string &nickname, const std::string &password, const std::string &suffix = "");
std::string getSessionName(const std::string &user, const std::string &legacyName);
std::string getTargetName(const std::string &legacyName);
private:
Config *m_config;
QTcpSocket *m_socket;
std::map<std::string, MyIrcSession *> m_sessions;
std::vector<std::string> m_servers;
int m_currentServer;
std::string m_identify;
bool m_firstPing;
};
|