Files
@ 794b2dbaa084
Branch filter:
Location: libtransport.git/backends/libcommuni/session.h
794b2dbaa084
3.5 KiB
text/plain
Merge branch 'master' of https://github.com/hanzz/libtransport
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | /*
* Copyright (C) 2008-2009 J-P Nurmi jpnurmi@gmail.com
*
* This example is free, and not covered by LGPL license. There is no
* restriction applied to their modification, redistribution, using and so on.
* You can study them, modify them, use them in your own program - either
* completely or partially. By using it you may give me some credits in your
* program, but you don't have to.
*/
#ifndef SESSION_H
#define SESSION_H
#include <IrcSession>
#include <transport/networkplugin.h>
using namespace Transport;
class MyIrcSession : public IrcSession
{
Q_OBJECT
public:
MyIrcSession(const std::string &user, NetworkPlugin *np, const std::string &suffix = "", QObject* parent = 0);
std::map<std::string, bool> m_modes;
std::string suffix;
int rooms;
void addAutoJoinChannel(const std::string &channel) {
m_autoJoin.push_back(channel);
}
void removeAutoJoinChannel(const std::string &channel) {
m_autoJoin.remove(channel);
}
void setIdentify(const std::string &identify) {
m_identify = identify;
}
const std::string &getIdentify() {
return m_identify;
}
bool correctNickname(std::string &nickname);
void on_joined(IrcMessage *message);
void on_parted(IrcMessage *message);
void on_quit(IrcMessage *message);
void on_nickChanged(IrcMessage *message);
void on_modeChanged(IrcMessage *message);
void on_topicChanged(IrcMessage *message);
void on_messageReceived(IrcMessage *message);
void on_numericMessageReceived(IrcMessage *message);
protected Q_SLOTS:
void on_connected();
void on_disconnected();
void onMessageReceived(IrcMessage* message);
protected:
NetworkPlugin *np;
std::string user;
std::string m_identify;
std::list<std::string> m_autoJoin;
std::string m_topicData;
};
//class MyIrcBuffer : public Irc::Buffer
//{
// Q_OBJECT
//public:
// MyIrcBuffer(const QString& receiver, const std::string &user, NetworkPlugin *np, const std::string &suffix, Irc::Session* parent);
// NetworkPlugin *np;
// std::string user;
// MyIrcSession *p;
// std::string m_topicData;
// std::string suffix;
//protected Q_SLOTS:
// void on_receiverChanged(const QString& receiver);
// void on_joined(const QString& origin);
// void on_parted(const QString& origin, const QString& message);
// void on_quit(const QString& origin, const QString& message);
// void on_nickChanged(const QString& origin, const QString& nick);
// void on_modeChanged(const QString& origin, const QString& mode, const QString& args);
// void on_topicChanged(const QString& origin, const QString& topic);
// void on_invited(const QString& origin, const QString& receiver, const QString& channel);
// void on_kicked(const QString& origin, const QString& nick, const QString& message);
// void on_messageReceived(const QString& origin, const QString& message, Irc::Buffer::MessageFlags flags);
// void on_noticeReceived(const QString& origin, const QString& notice, Irc::Buffer::MessageFlags flags);
// void on_ctcpRequestReceived(const QString& origin, const QString& request, Irc::Buffer::MessageFlags flags);
// void on_ctcpReplyReceived(const QString& origin, const QString& reply, Irc::Buffer::MessageFlags flags);
// void on_ctcpActionReceived(const QString& origin, const QString& action, Irc::Buffer::MessageFlags flags);
// void on_numericMessageReceived(const QString& origin, uint code, const QStringList& params);
// void on_unknownMessageReceived(const QString& origin, const QStringList& params);
// bool correctNickname(std::string &nickname);
//};
#endif // SESSION_H
|