summaryrefslogtreecommitdiff
authorskyhusker <skyhusker>2005-02-02 13:40:47 (UTC)
committer skyhusker <skyhusker>2005-02-02 13:40:47 (UTC)
commit1a5dc271114432e0e598af499c076bfbf69ff972 (patch) (side-by-side diff)
treef7f9b272949c51f818fbcfe4009f745c6a42fca5
parent737b0b5ce3e5db15bf11f696b070c9b475f92b61 (diff)
downloadopie-1a5dc271114432e0e598af499c076bfbf69ff972.zip
opie-1a5dc271114432e0e598af499c076bfbf69ff972.tar.gz
opie-1a5dc271114432e0e598af499c076bfbf69ff972.tar.bz2
Added a pointer to the mainwindow because it's needed by the dcc confirmation dialog
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircservertab.cpp2
-rw-r--r--noncore/net/opieirc/ircsession.cpp3
-rw-r--r--noncore/net/opieirc/ircsession.h3
3 files changed, 5 insertions, 3 deletions
diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp
index bddc37e..62a06e8 100644
--- a/noncore/net/opieirc/ircservertab.cpp
+++ b/noncore/net/opieirc/ircservertab.cpp
@@ -1,41 +1,41 @@
#include <qtextstream.h>
#include <qwhatsthis.h>
#include "ircservertab.h"
#include "ircmessageparser.h"
#include "ircchannelperson.h"
bool IRCServerTab::containsPing( const QString& text, IRCServerTab* tab ) {
return (text.contains(IRCMessageParser::tr("Received a CTCP PING from "))) ||
(text.find("ping") != -1 && text.find( tab->server()->nick() != -1));
}
IRCServerTab::IRCServerTab(IRCServer server, MainWindow *mainWindow, QWidget *parent, const char *name, WFlags f) : IRCTab(parent, name, f) {
m_server = server;
- m_session = new IRCSession(&m_server);
+ m_session = new IRCSession(this, &m_server);
m_mainWindow = mainWindow;
m_close = FALSE;
m_lines = 0;
m_description->setText(tr("Connecting to")+" <b>" + server.hostname() + ":" + QString::number(server.port()) + "</b>");
m_textview = new QTextView(this);
m_textview->setHScrollBarMode(QScrollView::AlwaysOff);
m_textview->setVScrollBarMode(QScrollView::AlwaysOn);
m_textview->setTextFormat(RichText);
QWhatsThis::add(m_textview, tr("Server messages"));
m_layout->add(m_textview);
m_field = new IRCHistoryLineEdit(this);
connect(m_field, SIGNAL(nextTab()), this, SIGNAL(nextTab()));
connect(m_field, SIGNAL(prevTab()), this, SIGNAL(prevTab()));
connect(m_field, SIGNAL(closeTab()), this, SIGNAL(closeTab()));
connect(this, SIGNAL(editFocus()), m_field, SLOT(setEditFocus()));
QWhatsThis::add(m_field, tr("Type commands here. A list of available commands can be found inside the OpieIRC help"));
m_layout->add(m_field);
connect(m_field, SIGNAL(returnPressed()), this, SLOT(processCommand()));
connect(m_session, SIGNAL(outputReady(IRCOutput)), this, SLOT(display(IRCOutput)));
connect(m_mainWindow, SIGNAL(updateScroll()), this, SLOT(scrolling()));
connect(m_session, SIGNAL(updateChannels()), this, SLOT(slotUpdateChannels()));
settingsChanged();
diff --git a/noncore/net/opieirc/ircsession.cpp b/noncore/net/opieirc/ircsession.cpp
index 80a327a..fd8ba72 100644
--- a/noncore/net/opieirc/ircsession.cpp
+++ b/noncore/net/opieirc/ircsession.cpp
@@ -1,34 +1,35 @@
#include "ircsession.h"
#include "ircmessageparser.h"
#include "ircchannelperson.h"
#include "ircversion.h"
-IRCSession::IRCSession(IRCServer *server) {
+IRCSession::IRCSession(QWidget *parent, IRCServer *server) {
m_server = server;
m_connection = new IRCConnection(m_server);
m_parser = new IRCMessageParser(this);
+ m_parent = parent;
connect(m_connection, SIGNAL(messageArrived(IRCMessage*)), this, SLOT(handleMessage(IRCMessage*)));
connect(m_parser, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput)));
connect(m_connection, SIGNAL(outputReady(IRCOutput)), this, SIGNAL(outputReady(IRCOutput)));
}
IRCSession::~IRCSession() {
/* We want this to get deleted automatically */
m_channels.setAutoDelete(TRUE);
m_people.setAutoDelete(TRUE);
delete m_parser;
delete m_connection;
}
void IRCSession::beginSession() {
m_connection->doConnect();
}
void IRCSession::join(QString channelname) {
m_connection->sendLine("JOIN " + channelname);
}
void IRCSession::quit(){
m_connection->sendLine("QUIT :[OI] I'm too good to need a reason");
diff --git a/noncore/net/opieirc/ircsession.h b/noncore/net/opieirc/ircsession.h
index 3859b68..7c91893 100644
--- a/noncore/net/opieirc/ircsession.h
+++ b/noncore/net/opieirc/ircsession.h
@@ -18,49 +18,49 @@
*/
#ifndef __IRCSESSION_H
#define __IRCSESSION_H
#include <qstring.h>
#include <qlist.h>
#include "ircserver.h"
#include "ircconnection.h"
#include "ircmessage.h"
#include "ircchannel.h"
#include "ircoutput.h"
class IRCMessageParser;
/* The IRCSession stores all information relating to the connection
to one IRC server. IRCSession makes it possible to run multiple
IRC server connections from within the same program */
class IRCSession : public QObject {
friend class IRCMessageParser;
Q_OBJECT
public:
- IRCSession(IRCServer *server);
+ IRCSession(QWidget *parent, IRCServer *server);
~IRCSession();
void join(QString channel);
void quit(QString message);
void quit();
void raw(QString message);
void topic(IRCChannel *channel, QString message);
void mode(IRCChannel *channel, QString message);
void mode(IRCPerson *person, QString message);
void mode(QString message);
void part(IRCChannel *channel);
void op(IRCChannel *channel, IRCPerson *person);
void kick(IRCChannel *channel, IRCPerson *person);
void kick(IRCChannel *channel, IRCPerson *person, QString message);
void beginSession();
bool isSessionActive();
void endSession();
bool isLoggedIn();
void sendMessage(IRCPerson *person, QString message);
void sendMessage(IRCChannel *channel, QString message);
void sendAction(IRCPerson *person, QString message);
void sendAction(IRCChannel *channel, QString message);
void updateNickname(const QString &oldNickname, const QString &newNickname);
void setValidUsermodes(const QString &modes);
@@ -69,27 +69,28 @@ public:
void sendCTCPPing(const QString &nickname);
void sendCTCPRequest(const QString &nickname, const QString &type, const QString &args);
void sendCTCPReply(const QString &nickname, const QString &type, const QString &args);
IRCChannel *getChannel(QString channelname);
IRCPerson *getPerson(QString nickname);
protected:
void addPerson(IRCPerson *person);
void addChannel(IRCChannel *channel);
void removeChannel(IRCChannel *channel);
void removePerson(IRCPerson *person);
void getChannelsByPerson(IRCPerson *person, QList<IRCChannel> &channels);
protected slots:
void handleMessage(IRCMessage *message);
signals:
void outputReady(IRCOutput output);
void updateChannels();
protected:
IRCServer *m_server;
IRCConnection *m_connection;
IRCMessageParser *m_parser;
QList<IRCChannel> m_channels;
QList<IRCPerson> m_people;
QString m_validUsermodes;
QString m_validChannelmodes;
+ QWidget *m_parent;
};
#endif /* __IRCSESSION_H */