author | wazlaf <wazlaf> | 2002-09-21 07:11:10 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-09-21 07:11:10 (UTC) |
commit | d8accaeed5f95340e8d293d6d5d1bb136c57fe35 (patch) (side-by-side diff) | |
tree | 8452081a1b36ab0db6b34a5a738ff7b64be641e9 | |
parent | 2f560ac908935bd4bc4a6b8852d27676100510bb (diff) | |
download | opie-d8accaeed5f95340e8d293d6d5d1bb136c57fe35.zip opie-d8accaeed5f95340e8d293d6d5d1bb136c57fe35.tar.gz opie-d8accaeed5f95340e8d293d6d5d1bb136c57fe35.tar.bz2 |
CTCP action now work via /me, HTML escaping now also works for text sent by yourself
-rw-r--r-- | noncore/net/opieirc/ircchanneltab.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opieirc/ircoutput.cpp | 6 | ||||
-rw-r--r-- | noncore/net/opieirc/ircoutput.h | 2 | ||||
-rw-r--r-- | noncore/net/opieirc/ircservertab.cpp | 11 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsession.cpp | 8 | ||||
-rw-r--r-- | noncore/net/opieirc/ircsession.h | 2 |
6 files changed, 31 insertions, 2 deletions
diff --git a/noncore/net/opieirc/ircchanneltab.cpp b/noncore/net/opieirc/ircchanneltab.cpp index 754442a..3267525 100644 --- a/noncore/net/opieirc/ircchanneltab.cpp +++ b/noncore/net/opieirc/ircchanneltab.cpp @@ -47,5 +47,7 @@ void IRCChannelTab::processCommand() { } else { + if (text.startsWith("//")) + text = text.right(text.length()-1); if (session()->isSessionActive()) { session()->sendMessage(m_channel, m_field->text()); - appendText("<<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>> "+m_field->text()+"<br>"); + appendText("<<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>> "+IRCOutput::toHTML(m_field->text())+"<br>"); } diff --git a/noncore/net/opieirc/ircoutput.cpp b/noncore/net/opieirc/ircoutput.cpp index 878bc9b..4822fc4 100644 --- a/noncore/net/opieirc/ircoutput.cpp +++ b/noncore/net/opieirc/ircoutput.cpp @@ -16,3 +16,7 @@ QString IRCOutput::message() { QString IRCOutput::htmlMessage() { - QString htmlMessage =m_message.replace(QRegExp("&"), "&"); + return toHTML(m_message); +} + +QString IRCOutput::toHTML(QString message) { + QString htmlMessage =message.replace(QRegExp("&"), "&"); htmlMessage = htmlMessage.replace(QRegExp(">"), ">"); diff --git a/noncore/net/opieirc/ircoutput.h b/noncore/net/opieirc/ircoutput.h index 72361d4..e8cc524 100644 --- a/noncore/net/opieirc/ircoutput.h +++ b/noncore/net/opieirc/ircoutput.h @@ -64,2 +64,4 @@ public: QString htmlMessage(); + + static QString toHTML(QString message); void *getParam(int index); diff --git a/noncore/net/opieirc/ircservertab.cpp b/noncore/net/opieirc/ircservertab.cpp index 2ad56a8..503a758 100644 --- a/noncore/net/opieirc/ircservertab.cpp +++ b/noncore/net/opieirc/ircservertab.cpp @@ -61,2 +61,13 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { } + } else if (command == "ME") { + QString text = IRCOutput::toHTML(line.right(line.length()-4)); + if (text.length() > 0) { + if (tab->isA("IRCChannelTab")) { + tab->appendText("<font color=\"#cc0000\">*" + m_server.nick() + " " + text + "</font><br>"); + m_session->sendAction(((IRCChannelTab *)tab)->channel(), text); + } else if (tab->isA("IRCQueryTab")) { + } else { + tab->appendText("<font color=\"#ff0000\">Invalid tab for this command</font><br>"); + } + } } else { diff --git a/noncore/net/opieirc/ircsession.cpp b/noncore/net/opieirc/ircsession.cpp index 89df68c..122a943 100644 --- a/noncore/net/opieirc/ircsession.cpp +++ b/noncore/net/opieirc/ircsession.cpp @@ -38,2 +38,10 @@ void IRCSession::sendMessage(IRCChannel *channel, QString message) { +void IRCSession::sendAction(IRCChannel *channel, QString message) { + m_connection->sendLine("PRIVMSG " + channel->channelname() + " :\001ACTION " + message + "\001"); +} + +void IRCSession::sendAction(IRCPerson *person, QString message) { + m_connection->sendLine("PRIVMSG " + person->nick() + " :\001ACTION " + message + "\001"); +} + bool IRCSession::isSessionActive() { diff --git a/noncore/net/opieirc/ircsession.h b/noncore/net/opieirc/ircsession.h index 59c26aa..aa4bed3 100644 --- a/noncore/net/opieirc/ircsession.h +++ b/noncore/net/opieirc/ircsession.h @@ -52,2 +52,4 @@ public: void sendMessage(IRCChannel *channel, QString message); + void sendAction(IRCPerson *person, QString message); + void sendAction(IRCChannel *channel, QString message); IRCChannel *getChannel(QString channelname); |