IrcChannel *Network::newIrcChannel(const QString &channelname) {
if(!_ircChannels.contains(channelname.toLower())) {
- IrcChannel *channel = new IrcChannel(channelname, this);
+ IrcChannel *channel = ircChannelFactory(channelname);
if(proxy())
proxy()->synchronize(channel);
while(channelIter != channelIterEnd) {
channelName = channelIter.key();
- ircChannel = new IrcChannel(channelName, this);
+ ircChannel = ircChannelFactory(channelName);
ircChannel->fromVariantMap(channelIter.value().toMap());
ircChannel->setInitialized();
proxy()->synchronize(ircChannel);
void disconnectRequested(NetworkId id = 0) const;
void setNetworkInfoRequested(const NetworkInfo &) const;
+protected:
+ inline virtual IrcChannel *ircChannelFactory(const QString &channelname) { return new IrcChannel(channelname, this); }
+
private:
QPointer<SignalProxy> _proxy;
corebufferviewconfig.cpp
corebufferviewmanager.cpp
corecoreinfo.cpp
+ coreircchannel.cpp
coreirclisthelper.cpp
corenetwork.cpp
coresession.cpp
corebufferviewconfig.h
corebufferviewmanager.h
corecoreinfo.h
+ coreircchannel.h
coreirclisthelper.h
corenetwork.h
coresession.h
#define CORENETWORK_H
#include "network.h"
+#include "coreircchannel.h"
class CoreSession;
virtual void requestDisconnect() const;
virtual void requestSetNetworkInfo(const NetworkInfo &info);
+protected:
+ inline virtual IrcChannel *ircChannelFactory(const QString &channelname) { return new CoreIrcChannel(channelname, this); }
+
private:
CoreSession *_coreSession;
};
#include "ctcphandler.h"
#include "ircuser.h"
-#include "ircchannel.h"
+#include "coreircchannel.h"
#include "logger.h"
#include <QDebug>
}
IrcServerHandler::~IrcServerHandler() {
-
}
/*! Handle a raw message string sent by the server. We try to find a suitable handler, otherwise we call a default handler. */
return;
QString target = serverDecode(params[0]);
+
+ // special treatment for welcome messages like:
+ // :ChanServ!ChanServ@services. NOTICE egst :[#apache] Welcome, this is #apache. Please read the in-channel topic message. This channel is being logged by IRSeekBot. If you have any question please see http://blog.freenode.net/?p=68
+ if(!network()->isChannelName(target)) {
+ QString msg = serverDecode(params[1]);
+ QRegExp welcomeRegExp("^\\[([^\\]]+)\\] ");
+ if(welcomeRegExp.indexIn(msg) != -1) {
+ QString channelname = welcomeRegExp.cap(1);
+ msg = msg.mid(welcomeRegExp.matchedLength());
+ CoreIrcChannel *chan = static_cast<CoreIrcChannel *>(network()->ircChannel(channelname)); // we only have CoreIrcChannels in the core, so this cast is safe
+ if(chan && !chan->receivedWelcomeMsg()) {
+ chan->setReceivedWelcomeMsg();
+ emit displayMsg(Message::Notice, BufferInfo::ChannelBuffer, channelname, msg, prefix);
+ return;
+ }
+ }
+ }
+
if(prefix.isEmpty() || target == "AUTH") {
target = "";
} else {