author | erik <erik> | 2007-07-09 22:06:00 (UTC) |
---|---|---|
committer | erik <erik> | 2007-07-09 22:06:00 (UTC) |
commit | a91bbaee9eb419dc985d9f5c3689831c8aa75c1e (patch) (unidiff) | |
tree | ba0da224a93f7af1a80a4bef3186edff8dc9483f | |
parent | 1ec355e1cc016edd2e322ff7d57469feaa46474b (diff) | |
download | opie-a91bbaee9eb419dc985d9f5c3689831c8aa75c1e.zip opie-a91bbaee9eb419dc985d9f5c3689831c8aa75c1e.tar.gz opie-a91bbaee9eb419dc985d9f5c3689831c8aa75c1e.tar.bz2 |
Fix for opie bug 1719. This should make opie-irc play nicer with utf-8.
Patches were culled from OE. Thanks to whoever the original patch author
was.
-rw-r--r-- | noncore/net/opieirc/ircconnection.cpp | 5 | ||||
-rw-r--r-- | noncore/net/opieirc/ircmessageparser.cpp | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/noncore/net/opieirc/ircconnection.cpp b/noncore/net/opieirc/ircconnection.cpp index 88e63f7..fb7e168 100644 --- a/noncore/net/opieirc/ircconnection.cpp +++ b/noncore/net/opieirc/ircconnection.cpp | |||
@@ -26,13 +26,14 @@ void IRCConnection::doConnect() { | |||
26 | 26 | ||
27 | /* Send commands to the IRC server */ | 27 | /* Send commands to the IRC server */ |
28 | void IRCConnection::sendLine(QString line) { | 28 | void IRCConnection::sendLine(QString line) { |
29 | while((line.right(1) == "\n") || (line.right(1) == "\r")) | 29 | while((line.right(1) == "\n") || (line.right(1) == "\r")) |
30 | line = line.left(line.length() - 1); | 30 | line = line.left(line.length() - 1); |
31 | line.append("\r\n"); | 31 | line.append("\r\n"); |
32 | m_socket->writeBlock(line, line.length()); | 32 | QCString uline = line.utf8(); |
33 | m_socket->writeBlock(uline, uline.length()); | ||
33 | } | 34 | } |
34 | 35 | ||
35 | void IRCConnection::sendCTCPReply(const QString &nickname, const QString &type, const QString &args) { | 36 | void IRCConnection::sendCTCPReply(const QString &nickname, const QString &type, const QString &args) { |
36 | sendLine("NOTICE " + nickname + " :\001" + type + " " + args + "\001"); | 37 | sendLine("NOTICE " + nickname + " :\001" + type + " " + args + "\001"); |
37 | } | 38 | } |
38 | 39 | ||
@@ -74,13 +75,13 @@ void IRCConnection::login() { | |||
74 | sendLine(loginString); | 75 | sendLine(loginString); |
75 | } | 76 | } |
76 | 77 | ||
77 | /* Called when data arrives on the socket */ | 78 | /* Called when data arrives on the socket */ |
78 | void IRCConnection::dataReady() { | 79 | void IRCConnection::dataReady() { |
79 | while(m_socket->canReadLine()) { | 80 | while(m_socket->canReadLine()) { |
80 | IRCMessage message(m_socket->readLine()); | 81 | IRCMessage message(QString::fromUtf8(m_socket->readLine())); |
81 | if (!m_loggedIn && message.isNumerical() && message.commandNumber() == 1) { | 82 | if (!m_loggedIn && message.isNumerical() && message.commandNumber() == 1) { |
82 | /* Now autojoin all channels specified inside the server profile */ | 83 | /* Now autojoin all channels specified inside the server profile */ |
83 | QStringList channels = QStringList::split(QChar(','), m_server->channels()); | 84 | QStringList channels = QStringList::split(QChar(','), m_server->channels()); |
84 | for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) { | 85 | for (QStringList::Iterator it = channels.begin(); it != channels.end(); ++it) { |
85 | QString channelName = (*it).stripWhiteSpace(); | 86 | QString channelName = (*it).stripWhiteSpace(); |
86 | if (channelName.startsWith("#") || channelName.startsWith("+")) { | 87 | if (channelName.startsWith("#") || channelName.startsWith("+")) { |
diff --git a/noncore/net/opieirc/ircmessageparser.cpp b/noncore/net/opieirc/ircmessageparser.cpp index c449a65..ae47f69 100644 --- a/noncore/net/opieirc/ircmessageparser.cpp +++ b/noncore/net/opieirc/ircmessageparser.cpp | |||
@@ -664,17 +664,17 @@ void IRCMessageParser::parseNumericalNoSuchNick(IRCMessage *) { | |||
664 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("No such nickname"))); | 664 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("No such nickname"))); |
665 | } | 665 | } |
666 | 666 | ||
667 | void IRCMessageParser::parseNumericalTopic(IRCMessage *message) { | 667 | void IRCMessageParser::parseNumericalTopic(IRCMessage *message) { |
668 | IRCChannel *channel = m_session->getChannel(message->param(1).lower()); | 668 | IRCChannel *channel = m_session->getChannel(message->param(1).lower()); |
669 | if (channel) { | 669 | if (channel) { |
670 | IRCOutput output(OUTPUT_TOPIC, tr("Topic for channel " + channel->channelname() + " is \"" + message->param(2) + "\"")); | 670 | IRCOutput output(OUTPUT_TOPIC, tr("Topic for channel ") + channel->channelname() + tr(" is \"") + message->param(2) + "\""); |
671 | output.addParam(channel); | 671 | output.addParam(channel); |
672 | emit outputReady(output); | 672 | emit outputReady(output); |
673 | } else { | 673 | } else { |
674 | IRCOutput output(OUTPUT_TOPIC, tr("Topic for channel " + message->param(1) + " is \"" + message->param(2) + "\"")); | 674 | IRCOutput output(OUTPUT_TOPIC, tr("Topic for channel ") + message->param(1) + tr(" is \"") + message->param(2) + "\""); |
675 | output.addParam(0); | 675 | output.addParam(0); |
676 | emit outputReady(output); | 676 | emit outputReady(output); |
677 | } | 677 | } |
678 | } | 678 | } |
679 | 679 | ||
680 | void IRCMessageParser::parseNumericalTopicWhoTime(IRCMessage *) { | 680 | void IRCMessageParser::parseNumericalTopicWhoTime(IRCMessage *) { |