Changeset 6690
- Timestamp:
- Apr 12, 2010, 3:30:51 PM (15 years ago)
- Location:
- code/branches/chat/src/orxonox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/chat/src/orxonox/ChatHistory.cc
r6688 r6690 33 33 { 34 34 #endif 35 /* QUESTION */ 35 36 /* is this necessary? if yes uncomment please :P */ 36 37 //CreateFactory(ChatHistory); … … 67 68 chat_hist_closelog(); 68 69 69 /* TODO clear list */ 70 /* clear list */ 71 this->hist_buffer.clear(); 70 72 } 71 73 … … 74 76 unsigned int senderID) 75 77 { 78 /* QUESTION */ 76 79 /* sanity - check for valid senderID */ 77 /* sanity - check for valid string format */78 80 79 /* format the message and senderID into a line */80 std::string buf= "" + senderID; /* NOTE to be changed */81 /* TODO make a correct name */ 82 std::string name = "" + senderID; /* NOTE to be changed */ 81 83 82 84 /* TODO */ 85 /* QUESTION */ 83 86 /* --> a) look up the actual name of the sender */ 84 87 /* --> b) add sender name and string up with a separator … … 87 90 88 91 /* add the line to the history */ 89 this->chat_hist_addline( buf+ ": " + message );92 this->chat_hist_addline( name + ": " + message ); 90 93 91 94 /* add the line to the log */ 92 this->chat_hist_logline( buf+ ": " + message );95 this->chat_hist_logline( name + ": " + message ); 93 96 } 94 97 … … 109 112 /* push to the front of the history */ 110 113 this->hist_buffer.push_back( toadd ); 111 112 114 } 113 115 … … 115 117 int ChatHistory::chat_hist_logline( const std::string& toadd ) 116 118 { 117 /* TODO use already written class to batch write to file118 * so not every line gets written on its own119 */120 119 /* output the line to the file if logging is enabled */ 121 120 if( this->hist_log_enabled ) … … 126 125 int ChatHistory::chat_hist_openlog() 127 126 { 127 /* QUESTION */ 128 128 /* TODO: find out the name of the file to log to via settings 129 129 * and set the this->hist_logfile_path variable to it … … 132 132 std::fstream::out | std::fstream::app ); 133 133 134 /* QUESTION */ 134 135 /* TODO check whether this works (not sure how you'd like it?) */ 135 136 … … 150 151 void ChatHistory::debug_printhist() 151 152 { 153 /* create deque iterator */ 152 154 std::deque<std::string>::iterator it; 153 155 156 /* output all the strings */ 154 157 for( it = this->hist_buffer.begin(); it != this->hist_buffer.end(); 155 158 ++it ) 156 159 std::cout << *it << std::endl; 157 160 161 /* output size */ 158 162 std::cout << "Size: " << hist_buffer.size() << std::endl; 159 160 161 163 } 162 164 -
code/branches/chat/src/orxonox/ChatHistory.h
r6688 r6690 32 32 #include <iostream> 33 33 34 /* define this if you're unit testing */ 34 35 #define TEST 0 35 36 … … 80 81 int syncLog(); 81 82 82 /** debug-print */83 /** debug-print: output the whole history to stdout */ 83 84 void debug_printhist(); 84 85 … … 133 134 #endif 134 135 135 136 136 #endif /* _ChatHistory_H__ */
Note: See TracChangeset
for help on using the changeset viewer.