summaryrefslogtreecommitdiff
authorfliplap <fliplap>2003-07-22 05:38:38 (UTC)
committer fliplap <fliplap>2003-07-22 05:38:38 (UTC)
commit059af0e82a14a32f068c2ad943dc918afca93587 (patch) (side-by-side diff)
tree1e669194d65a5c9098434115f7b8e5ce3693b14d
parentd672a787dd122410063ac6cb721be8b5f8cd418e (diff)
downloadopie-059af0e82a14a32f068c2ad943dc918afca93587.zip
opie-059af0e82a14a32f068c2ad943dc918afca93587.tar.gz
opie-059af0e82a14a32f068c2ad943dc918afca93587.tar.bz2
getting all my stuff syncd up. Fixed scroll issue, added commands
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircmessageparser.cpp20
-rw-r--r--noncore/net/opieirc/ircperson.cpp2
-rw-r--r--noncore/net/opieirc/ircsettings.cpp2
3 files changed, 12 insertions, 12 deletions
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp
index e8d3b1a..6b88f34 100644
--- a/noncore/net/opieirc/ircmessageparser.cpp
+++ b/noncore/net/opieirc/ircmessageparser.cpp
@@ -50,218 +50,218 @@ IRCNumericalMessageParserStruct IRCMessageParser::numericalParserProcTable[] = {
{ 376, FUNC(parseNumericalStats) }, // RPL_ENDOFMOTD
{ 377, FUNC(parseNumericalStats) }, // RPL_MOTD2
{ 378, FUNC(parseNumericalStats) }, // RPL_MOTD3
{ 401, FUNC(parseNumericalNoSuchNick) }, // ERR_NOSUCHNICK
{ 406, FUNC(parseNumericalNoSuchNick) }, // ERR_WASNOSUCHNICK
{ 412, FUNC(parseNumericalStats) }, // ERR_NOTEXTTOSEND
{ 433, FUNC(parseNumericalNicknameInUse) }, // ERR_NICKNAMEINUSE
{ 0, 0 }
};
IRCMessageParser::IRCMessageParser(IRCSession *session) {
m_session = session;
}
void IRCMessageParser::parse(IRCMessage *message) {
/* Find out what kind of message we have here and call the appropriate handler using
the parser tables. If no handler can be found, print out an error message */
if (message->isNumerical()) {
for (int i=0; i<numericalParserProcTable[i].commandNumber; i++) {
if (message->commandNumber() == numericalParserProcTable[i].commandNumber) {
(this->*(numericalParserProcTable[i].proc))(message);
return;
}
}
- emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received unhandled numeric command : ")+QString::number(message->commandNumber())));
+ emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received unhandled numeric command: %1").arg( QString::number(message->commandNumber()) )));
} else if (message->isCTCP()) {
for (int i=0; ctcpParserProcTable[i].commandName; i++) {
if (message->ctcpCommand() == ctcpParserProcTable[i].commandName) {
(this->*(ctcpParserProcTable[i].proc))(message);
return;
}
}
- emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received unhandled ctcp command : ")+message->ctcpCommand()));
+ emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received unhandled ctcp command: %1").arg( message->ctcpCommand())) );
} else {
for (int i=0; literalParserProcTable[i].commandName; i++) {
if (message->command() == literalParserProcTable[i].commandName) {
(this->*(literalParserProcTable[i].proc))(message);
return;
}
}
- emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received unhandled literal command : ")+message->command()));
+ emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received unhandled literal command: %1").arg( message->command()) ));
}
}
void IRCMessageParser::nullFunc(IRCMessage *) {
/* Do nothing */
}
void IRCMessageParser::parseLiteralPing(IRCMessage *message) {
m_session->m_connection->sendLine("PONG " + message->allParameters());
}
void IRCMessageParser::parseLiteralNotice(IRCMessage *message) {
emit outputReady(IRCOutput(OUTPUT_SERVERMESSAGE, message->allParameters()));
}
void IRCMessageParser::parseLiteralJoin(IRCMessage *message) {
QString channelName = message->param(0).lower();
IRCPerson mask(message->prefix());
IRCChannel *channel = m_session->getChannel(channelName);
if (!channel) {
/* We joined */
if (mask.nick() == m_session->m_server->nick()) {
channel = new IRCChannel(channelName);
m_session->addChannel(channel);
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Nonexistant channel join - desynchronized?")));
}
} else {
/* Someone else joined */
if (mask.nick() != m_session->m_server->nick()) {
if (!channel->getPerson(mask.nick())) {
IRCChannelPerson *chanperson = new IRCChannelPerson();
IRCPerson *person = m_session->getPerson(mask.nick());
if (!person) {
person = new IRCPerson(message->prefix());
m_session->addPerson(person);
}
chanperson->flags = 0;
chanperson->person = person;
channel->addPerson(chanperson);
- IRCOutput output(OUTPUT_OTHERJOIN, mask.nick() + tr(" joined channel ") + channelName);
+ IRCOutput output(OUTPUT_OTHERJOIN ,tr("%1 joined channel %2").arg( mask.nick() ).arg( channelName ));
output.addParam(channel);
output.addParam(chanperson);
emit outputReady(output);
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Person has already joined the channel - desynchronized?")));
}
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("You already joined the channel - desynchronized?")));
}
}
}
void IRCMessageParser::parseLiteralPart(IRCMessage *message) {
QString channelName = message->param(0).lower();
IRCChannel *channel = m_session->getChannel(channelName);
IRCPerson mask(message->prefix());
if (channel) {
if (mask.nick() == m_session->m_server->nick()) {
m_session->removeChannel(channel);
- IRCOutput output(OUTPUT_SELFPART, tr("You left channel ") + channelName);
+ IRCOutput output(OUTPUT_SELFPART, tr("You left channel %1").arg( channelName ));
output.addParam(channel);
emit outputReady(output);
delete channel;
} else {
IRCChannelPerson *person = channel->getPerson(mask.nick());
if (person) {
channel->removePerson(person);
- IRCOutput output(OUTPUT_OTHERPART, mask.nick() + tr(" left channel ") + channelName);
+ IRCOutput output(OUTPUT_OTHERPART, tr("%1 left channel %2").arg( mask.nick() ).arg( channelName) );
output.addParam(channel);
output.addParam(person);
emit outputReady(output);
delete person;
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Parting person not found - desynchronized?")));
}
}
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel for part not found - desynchronized?")));
}
}
void IRCMessageParser::parseLiteralPrivMsg(IRCMessage *message) {
if (m_session->m_server->nick() == message->param(0)) {
/* IRC Query message detected, verify sender and display it */
IRCPerson mask(message->prefix());
IRCPerson *person = m_session->getPerson(mask.nick());
if (!person) {
/* Person not yet known, create and add to the current session */
person = new IRCPerson(message->prefix());
m_session->addPerson(person);
}
IRCOutput output(OUTPUT_QUERYPRIVMSG, message->param(1));
output.addParam(person);
emit outputReady(output);
} else if (message->param(0).at(0) == '#' || message->param(0).at(0) == '+') {
/* IRC Channel message detected, verify sender, channel and display it */
IRCChannel *channel = m_session->getChannel(message->param(0).lower());
if (channel) {
IRCPerson mask(message->prefix());
IRCChannelPerson *person = channel->getPerson(mask.nick());
if (person) {
IRCOutput output(OUTPUT_CHANPRIVMSG, message->param(1));
output.addParam(channel);
output.addParam(person);
emit outputReady(output);
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown sender")));
}
} else {
- emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel ") + message->param(0).lower()));
+ emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Channel message with unknown channel %1").arg(message->param(0).lower()) ));
}
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Received PRIVMSG of unknown type")));
}
}
void IRCMessageParser::parseLiteralNick(IRCMessage *message) {
IRCPerson mask(message->prefix());
if (mask.nick() == m_session->m_server->nick()) {
/* We are changing our nickname */
m_session->m_server->setNick(message->param(0));
- IRCOutput output(OUTPUT_NICKCHANGE, tr("You are now known as ")+message->param(0));
+ IRCOutput output(OUTPUT_NICKCHANGE, tr("You are now known as %1").arg( message->param(0)));
output.addParam(0);
emit outputReady(output);
} else {
/* Someone else is */
IRCPerson *person = m_session->getPerson(mask.nick());
if (person) {
- IRCOutput output(OUTPUT_NICKCHANGE, mask.nick() + tr(" is now known as ") + message->param(0));
+ IRCOutput output(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg( mask.nick() ).arg( message->param(0 )));
output.addParam(person);
emit outputReady(output);
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Nickname change of an unknown person")));
}
}
}
void IRCMessageParser::parseLiteralQuit(IRCMessage *message) {
IRCPerson mask(message->prefix());
IRCPerson *person = m_session->getPerson(mask.nick());
if (person) {
QList<IRCChannel> channels;
m_session->getChannelsByPerson(person, channels);
QListIterator<IRCChannel> it(channels);
for (;it.current(); ++it) {
IRCChannelPerson *chanperson = it.current()->getPerson(mask.nick());
it.current()->removePerson(chanperson);
delete chanperson;
}
m_session->removePerson(person);
- IRCOutput output(OUTPUT_QUIT, mask.nick() + tr(" has quit ") + "(" + message->param(0) + ")");
+ IRCOutput output(OUTPUT_QUIT, tr("%1 has quit (%2)" ).arg( mask.nick() ).arg( message->param(0) ));
output.addParam(person);
emit outputReady(output);
delete person;
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown person quit - desynchronized?")));
}
}
void IRCMessageParser::parseLiteralTopic(IRCMessage *message) {
IRCPerson mask(message->prefix());
IRCChannel *channel = m_session->getChannel(message->param(0).lower());
if (channel) {
IRCOutput output(OUTPUT_TOPIC, mask.nick() + tr(" changed topic to ") + "\"" + message->param(1) + "\"");
output.addParam(channel);
emit outputReady(output);
} else {
emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Unknown channel topic - desynchronized?")));
}
}
void IRCMessageParser::parseLiteralError(IRCMessage *message) {
emit outputReady(IRCOutput(OUTPUT_ERROR, message->allParameters()));
}
diff --git a/noncore/net/opieirc/ircperson.cpp b/noncore/net/opieirc/ircperson.cpp
index 2f5b435..1dd2679 100644
--- a/noncore/net/opieirc/ircperson.cpp
+++ b/noncore/net/opieirc/ircperson.cpp
@@ -20,36 +20,36 @@ IRCPerson::IRCPerson(QString mask) {
void IRCPerson::fromMask(QString mask) {
int sep1 = mask.find("!");
int sep2 = mask.find("@");
m_nick = mask.left(sep1);
m_user = mask.mid(sep1+1, sep2-sep1-1);
m_host = mask.right(mask.length()-sep2-1);
}
QString IRCPerson::toMask() {
return m_nick + "!" + m_user + "@" + m_host;
}
void IRCPerson::setNick(QString nick) {
m_nick = nick;
}
void IRCPerson::setUser(QString user) {
m_user = user;
}
void IRCPerson::setHost(QString host) {
m_host = host;
}
-
+ // -- GETTER FUNCS --
QString IRCPerson::nick() {
return m_nick;
}
QString IRCPerson::user() {
return m_user;
}
QString IRCPerson::host() {
return m_host;
}
diff --git a/noncore/net/opieirc/ircsettings.cpp b/noncore/net/opieirc/ircsettings.cpp
index b110a5b..70d5445 100644
--- a/noncore/net/opieirc/ircsettings.cpp
+++ b/noncore/net/opieirc/ircsettings.cpp
@@ -1,36 +1,36 @@
#include <opie/ocolorbutton.h>
#include <opie/otabwidget.h>
#include <qlayout.h>
#include <qvalidator.h>
#include <qscrollview.h>
#include <qwhatsthis.h>
#include "ircsettings.h"
#include "irctab.h"
#include "ircmisc.h"
IRCSettings::IRCSettings(QWidget* parent, const char* name, bool modal, WFlags) : QDialog(parent, name, modal, WStyle_ContextHelp) {
- setCaption("Settings");
+ setCaption(tr("Settings") );
m_config = new Config("OpieIRC");
m_config->setGroup("OpieIRC");
QHBoxLayout *l = new QHBoxLayout(this, 2, 2);
OTabWidget *tw = new OTabWidget(this);
l->addWidget(tw);
/* General Configuration */
QWidget *genwidget = new QWidget(tw);
QGridLayout *layout = new QGridLayout(genwidget, 1, 2, 5, 0);
QLabel *label = new QLabel(tr("Lines displayed :"), genwidget);
layout->addWidget(label, 0, 0);
m_lines = new QLineEdit(m_config->readEntry("Lines", "100"), genwidget);
QWhatsThis::add(m_lines, tr("Amount of lines to be displayed in chats before old lines get deleted - this is necessary to restrain memory consumption. Set to 0 if you don't need this"));
QIntValidator *validator = new QIntValidator(this);
validator->setTop(10000);
validator->setBottom(0);
m_lines->setValidator(validator);
layout->addWidget(m_lines, 0, 1);
tw->addTab(genwidget, "opieirc/settings", tr("General"));
/* Color configuration */
QScrollView *view = new QScrollView(this);
view->setResizePolicy(QScrollView::AutoOneFit);
view->setFrameStyle( QFrame::NoFrame );
QWidget *widget = new QWidget(view->viewport());