// NOTE: This assumes that this is true in raw encoding, but well, hopefully there are no servers running in japanese on protocol level...
int idx = msg.indexOf(" :");
if(idx >= 0) {
- if(msg.length() > idx + 2) trailing = msg.mid(idx + 2);
+ if(msg.length() > idx + 2)
+ trailing = msg.mid(idx + 2);
msg = msg.left(idx);
}
// OK, now it is safe to split...
QList<QByteArray> params = msg.split(' ');
+
+ // This could still contain empty elements due to (faulty?) ircds sending multiple spaces in a row
+ // Also, QByteArray is not nearly as convenient to work with as QString for such things :)
+ QList<QByteArray>::iterator iter = params.begin();
+ while(iter != params.end()) {
+ if(iter->isEmpty())
+ iter = params.erase(iter);
+ else
+ ++iter;
+ }
+
if(!trailing.isEmpty()) params << trailing;
if(params.count() < 1) {
qWarning() << "Received invalid string from server!";
handleMode(prefix, params);
}
+/* RPL_??? - "<channel> <homepage> */
+void IrcServerHandler::handle328(const QString &prefix, const QList<QByteArray> ¶ms) {
+ Q_UNUSED(prefix);
+ if(!checkParamCount("IrcServerHandler::handle328()", params, 2))
+ return;
+
+ QString channel = serverDecode(params[0]);
+ QString homepage = serverDecode(params[1]);
+
+ emit displayMsg(Message::Server, BufferInfo::ChannelBuffer, channel, tr("Homepage for %1 is %2").arg(channel, homepage));
+}
+
+
/* RPL_??? - "<channel> <creation time (unix)>" */
void IrcServerHandler::handle329(const QString &prefix, const QList<QByteArray> ¶ms) {
Q_UNUSED(prefix);
- Q_UNUSED(params)
-#ifdef __GNUC__
-# warning "Implement handle329 (Channel creation time)"
-#endif
- // FIXME implement this...
+ if(!checkParamCount("IrcServerHandler::handle329()", params, 2))
+ return;
+
+ QString channel = serverDecode(params[0]);
+ uint unixtime = params[1].toUInt();
+ if(!unixtime) {
+ qWarning() << Q_FUNC_INFO << "received invalid timestamp:" << params[1];
+ return;
+ }
+ QDateTime time = QDateTime::fromTime_t(unixtime);
+
+ emit displayMsg(Message::Server, BufferInfo::ChannelBuffer, channel, tr("Channel %1 created on %2").arg(channel, time.toString()));
}
/* RPL_NOTOPIC */