/***************************************************************************
- * Copyright (C) 2005-08 by the Quassel Project *
+ * Copyright (C) 2005-09 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
// if there is no message supplied we have to check if we are already away or not
if(msg.isEmpty()) {
- if(me && !me->isAway())
+ if(me && !me->isAway()) {
awayMsg = network()->identityPtr()->awayReason();
+ if(awayMsg.isEmpty()) {
+ awayMsg = tr("away");
+ }
+ }
}
if(me)
me->setAwayMessage(awayMsg);
return;
}
- if(generalizedHost.lastIndexOf(".") != -1 && generalizedHost.lastIndexOf(".", generalizedHost.lastIndexOf(".")-1) != -1) {
+ static QRegExp ipAddress("\\d+\\.\\d+\\.\\d+\\.\\d+");
+ if(ipAddress.exactMatch(generalizedHost)) {
+ int lastDotPos = generalizedHost.lastIndexOf('.') + 1;
+ generalizedHost.replace(lastDotPos, generalizedHost.length() - lastDotPos, '*');
+ } else if(generalizedHost.lastIndexOf(".") != -1 && generalizedHost.lastIndexOf(".", generalizedHost.lastIndexOf(".")-1) != -1) {
int secondLastPeriodPosition = generalizedHost.lastIndexOf(".", generalizedHost.lastIndexOf(".")-1);
generalizedHost.replace(0, secondLastPeriodPosition, "*");
}
}
void UserInputHandler::issueQuit(const QString &reason) {
- QString quitReason;
- if(reason.isEmpty())
- quitReason = network()->identityPtr()->quitReason();
- else
- quitReason = reason;
- emit putCmd("QUIT", serverEncode(quitReason));
+ emit putCmd("QUIT", serverEncode(reason));
}
void UserInputHandler::handleQuote(const BufferInfo &bufferInfo, const QString &msg) {
void UserInputHandler::putPrivmsg(const QByteArray &target, const QByteArray &message) {
static const char *cmd = "PRIVMSG";
- int overrun = lastParamOverrun(cmd, QList<QByteArray>() << message);
+ int overrun = lastParamOverrun(cmd, QList<QByteArray>() << target << message);
if(overrun) {
static const char *splitter = " .,-";
int maxSplitPos = message.count() - overrun;
}
}
-
void UserInputHandler::timerEvent(QTimerEvent *event) {
if(!_delayedCommands.contains(event->timerId())) {
QObject::timerEvent(event);