author | wazlaf <wazlaf> | 2002-09-21 07:11:10 (UTC) |
---|---|---|
committer | wazlaf <wazlaf> | 2002-09-21 07:11:10 (UTC) |
commit | d8accaeed5f95340e8d293d6d5d1bb136c57fe35 (patch) (unidiff) | |
tree | 8452081a1b36ab0db6b34a5a738ff7b64be641e9 /noncore | |
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 | |||
@@ -46,7 +46,9 @@ void IRCChannelTab::processCommand() { | |||
46 | m_parentTab->executeCommand(this, text);; | 46 | m_parentTab->executeCommand(this, text);; |
47 | } else { | 47 | } else { |
48 | if (text.startsWith("//")) | ||
49 | text = text.right(text.length()-1); | ||
48 | if (session()->isSessionActive()) { | 50 | if (session()->isSessionActive()) { |
49 | session()->sendMessage(m_channel, m_field->text()); | 51 | session()->sendMessage(m_channel, m_field->text()); |
50 | appendText("<<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>> "+m_field->text()+"<br>"); | 52 | appendText("<<font color=\"#dd0000\">"+m_parentTab->server()->nick()+"</font>> "+IRCOutput::toHTML(m_field->text())+"<br>"); |
51 | } | 53 | } |
52 | } | 54 | } |
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 | |||
@@ -15,5 +15,9 @@ QString IRCOutput::message() { | |||
15 | 15 | ||
16 | QString IRCOutput::htmlMessage() { | 16 | QString IRCOutput::htmlMessage() { |
17 | QString htmlMessage =m_message.replace(QRegExp("&"), "&"); | 17 | return toHTML(m_message); |
18 | } | ||
19 | |||
20 | QString IRCOutput::toHTML(QString message) { | ||
21 | QString htmlMessage =message.replace(QRegExp("&"), "&"); | ||
18 | htmlMessage = htmlMessage.replace(QRegExp(">"), ">"); | 22 | htmlMessage = htmlMessage.replace(QRegExp(">"), ">"); |
19 | htmlMessage = htmlMessage.replace(QRegExp("<"), "<"); | 23 | 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 | |||
@@ -63,4 +63,6 @@ public: | |||
63 | /* Return the message with all HTML code escaped (for example < instead of '<') */ | 63 | /* Return the message with all HTML code escaped (for example < instead of '<') */ |
64 | QString htmlMessage(); | 64 | QString htmlMessage(); |
65 | |||
66 | static QString toHTML(QString message); | ||
65 | void *getParam(int index); | 67 | void *getParam(int index); |
66 | protected: | 68 | protected: |
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 | |||
@@ -60,4 +60,15 @@ void IRCServerTab::executeCommand(IRCTab *tab, QString line) { | |||
60 | tab->appendText("<font color=\"#ff0000\">Unknown channel format!</font><br>"); | 60 | tab->appendText("<font color=\"#ff0000\">Unknown channel format!</font><br>"); |
61 | } | 61 | } |
62 | } else if (command == "ME") { | ||
63 | QString text = IRCOutput::toHTML(line.right(line.length()-4)); | ||
64 | if (text.length() > 0) { | ||
65 | if (tab->isA("IRCChannelTab")) { | ||
66 | tab->appendText("<font color=\"#cc0000\">*" + m_server.nick() + " " + text + "</font><br>"); | ||
67 | m_session->sendAction(((IRCChannelTab *)tab)->channel(), text); | ||
68 | } else if (tab->isA("IRCQueryTab")) { | ||
69 | } else { | ||
70 | tab->appendText("<font color=\"#ff0000\">Invalid tab for this command</font><br>"); | ||
71 | } | ||
72 | } | ||
62 | } else { | 73 | } else { |
63 | tab->appendText("<font color=\"#ff0000\">Unknown command</font><br>"); | 74 | 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 | |||
@@ -37,4 +37,12 @@ void IRCSession::sendMessage(IRCChannel *channel, QString message) { | |||
37 | } | 37 | } |
38 | 38 | ||
39 | void IRCSession::sendAction(IRCChannel *channel, QString message) { | ||
40 | m_connection->sendLine("PRIVMSG " + channel->channelname() + " :\001ACTION " + message + "\001"); | ||
41 | } | ||
42 | |||
43 | void IRCSession::sendAction(IRCPerson *person, QString message) { | ||
44 | m_connection->sendLine("PRIVMSG " + person->nick() + " :\001ACTION " + message + "\001"); | ||
45 | } | ||
46 | |||
39 | bool IRCSession::isSessionActive() { | 47 | bool IRCSession::isSessionActive() { |
40 | return m_connection->isConnected(); | 48 | 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 | |||
@@ -51,4 +51,6 @@ public: | |||
51 | void sendMessage(IRCPerson *person, QString message); | 51 | void sendMessage(IRCPerson *person, QString message); |
52 | void sendMessage(IRCChannel *channel, QString message); | 52 | void sendMessage(IRCChannel *channel, QString message); |
53 | void sendAction(IRCPerson *person, QString message); | ||
54 | void sendAction(IRCChannel *channel, QString message); | ||
53 | IRCChannel *getChannel(QString channelname); | 55 | IRCChannel *getChannel(QString channelname); |
54 | IRCPerson *getPerson(QString nickname); | 56 | IRCPerson *getPerson(QString nickname); |