From e8cf7d5436f7b525e79b9d5949e34bc5f8024fa0 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Fri, 4 Mar 2005 23:23:20 +0000 Subject: README updates for 0.0.10 and made chat messages wrap at 80 characters. --- src/gui/chat.cpp | 58 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) (limited to 'src/gui') diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 5c947859..82c808be 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -78,37 +78,39 @@ void ChatBox::chat_log(std::string line, int own) // A try to get text sentences no too long... bool finished = false; - while (!finished) - { - std::string tempText; - if (line.length() > 60) - { - - if (line.length() > 60) - tempText = line.substr(0, 60); - else - tempText = line; - - tmp.text = tempText; - - //chatlog_file << tmp.nick << tmp.text << "\n"; - //chatlog_file.flush(); + int maxLength = 80; - chatlog.push_front(tmp); - - if ( line.length() > 60 ) - line = line.substr(60, line.length() - 60); - } - else // Normal message - { - tmp.text = line; - //chatlog_file << tmp.nick << tmp.text << "\n"; - //chatlog_file.flush(); + while (!finished) + { + std::string tempText; + if (line.length() > maxLength) + { - chatlog.push_front(tmp); - finished = true; - } + if (line.length() > maxLength) + tempText = line.substr(0, maxLength); + else + tempText = line; + + tmp.text = tempText; + + //chatlog_file << tmp.nick << tmp.text << "\n"; + //chatlog_file.flush(); + + chatlog.push_front(tmp); + + if (line.length() > maxLength) + line = line.substr(maxLength, line.length() - maxLength); } + else // Normal message + { + tmp.text = line; + //chatlog_file << tmp.nick << tmp.text << "\n"; + //chatlog_file.flush(); + + chatlog.push_front(tmp); + finished = true; + } + } } void ChatBox::chat_log(CHATSKILL action) { -- cgit v1.2.3-70-g09d2