summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchanneltab.cpp4
-rw-r--r--noncore/net/opieirc/ircoutput.cpp6
-rw-r--r--noncore/net/opieirc/ircoutput.h2
-rw-r--r--noncore/net/opieirc/ircservertab.cpp11
-rw-r--r--noncore/net/opieirc/ircsession.cpp8
-rw-r--r--noncore/net/opieirc/ircsession.h2
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
@@ -44,11 +44,13 @@ void IRCChannelTab::processCommand() {
if (text.startsWith("/") && !text.startsWith("//")) {
/* Command mode */
m_parentTab->executeCommand(this, text);;
} else {
+ if (text.startsWith("//"))
+ text = text.right(text.length()-1);
if (session()->isSessionActive()) {
session()->sendMessage(m_channel, m_field->text());
- appendText("&lt;<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>&gt; "+m_field->text()+"<br>");
+ appendText("&lt;<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>&gt; "+IRCOutput::toHTML(m_field->text())+"<br>");
}
}
} else {
appendText("<font color=\"#ff0000\">"+tr("Disconnected")+"</font><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
@@ -13,9 +13,13 @@ QString IRCOutput::message() {
return m_message;
}
QString IRCOutput::htmlMessage() {
- QString htmlMessage =m_message.replace(QRegExp("&"), "&amp;");
+ return toHTML(m_message);
+}
+
+QString IRCOutput::toHTML(QString message) {
+ QString htmlMessage =message.replace(QRegExp("&"), "&amp;");
htmlMessage = htmlMessage.replace(QRegExp(">"), "&gt;");
htmlMessage = htmlMessage.replace(QRegExp("<"), "&lt;");
return htmlMessage;
}
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
@@ -61,8 +61,10 @@ public:
IRCOutputType type();
QString message();
/* Return the message with all HTML code escaped (for example &lt; instead of '<') */
QString htmlMessage();
+
+ static QString toHTML(QString message);
void *getParam(int index);
protected:
IRCOutputType m_type;
QString m_message;
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
@@ -58,8 +58,19 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) {
m_session->join(channel);
} else {
tab->appendText("<font color=\"#ff0000\">Unknown channel format!</font><br>");
}
+ } 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 {
tab->appendText("<font color=\"#ff0000\">Unknown command</font><br>");
}
}
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
@@ -35,8 +35,16 @@ void IRCSession::sendMessage(IRCPerson *person, QString message) {
void IRCSession::sendMessage(IRCChannel *channel, QString message) {
m_connection->sendLine("PRIVMSG " + channel->channelname() + " :" + 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() {
return m_connection->isConnected();
}
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
@@ -49,8 +49,10 @@ public:
void endSession();
void sendMessage(IRCPerson *person, QString message);
void sendMessage(IRCChannel *channel, QString message);
+ void sendAction(IRCPerson *person, QString message);
+ void sendAction(IRCChannel *channel, QString message);
IRCChannel *getChannel(QString channelname);
IRCPerson *getPerson(QString nickname);
protected:
void addPerson(IRCPerson *person);