Rev 1 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 161 | ||
---|---|---|---|
Line 124... | Line 124... | ||
124 | 124 | ||
125 | return (NULL); // we couldn't find that interlocutor, return FALSE |
125 | return (NULL); // we couldn't find that interlocutor, return FALSE |
126 | } |
126 | } |
127 | 127 | ||
128 | 128 | ||
129 | void Interlocutor_Chat (interlocutor_t *interlocutor, const wchar_t *sender, bool is_localsender, const wchar_t * |
129 | void Interlocutor_Chat (interlocutor_t *interlocutor, const wchar_t *sender, bool is_localsender, const wchar_t *message) |
130 | { |
130 | { |
131 | // helper function to quickly add an entry to an interlocutor's RTF chat window |
131 | // helper function to quickly add an entry to an interlocutor's RTF chat window |
132 | 132 | ||
133 | // {\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard |
133 | // {\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard |
134 | // This is some {\b bold} text.\par |
134 | // This is some {\b bold} text.\par |
Line 137... | Line 137... | ||
137 | 137 | ||
138 | static const wchar_t rtf_template[] = L"{\\cf%d\\b %s}\\par\n" |
138 | static const wchar_t rtf_template[] = L"{\\cf%d\\b %s}\\par\n" |
139 | L" %s\\par\n" |
139 | L" %s\\par\n" |
140 | L"}\n"; |
140 | L"}\n"; |
141 | static const int template_length = WCHAR_SIZEOF (rtf_template) - 6 - 2; // don't take in account closing brace, it's counted in the header |
141 | static const int template_length = WCHAR_SIZEOF (rtf_template) - 6 - 2; // don't take in account closing brace, it's counted in the header |
142 | va_list argptr; |
- | |
143 | int sender_length; |
142 | int sender_length; |
144 | int text_length; |
143 | int text_length; |
145 | int smiley_index; |
144 | int smiley_index; |
146 | smiley_t *smiley; |
145 | smiley_t *smiley; |
147 | wchar_t *smiley_text; |
146 | wchar_t *smiley_text; |
Line 154... | Line 153... | ||
154 | wcscpy_s (interlocutor->dialogtext, WCHAR_SIZEOF (rtf_header), rtf_header); // copy RTF header |
153 | wcscpy_s (interlocutor->dialogtext, WCHAR_SIZEOF (rtf_header), rtf_header); // copy RTF header |
155 | interlocutor->dialogtext_size = WCHAR_SIZEOF (rtf_header); // save RTF header length |
154 | interlocutor->dialogtext_size = WCHAR_SIZEOF (rtf_header); // save RTF header length |
156 | } |
155 | } |
157 | 156 | ||
158 | // concatenate all the arguments in one string, but have a space before and after it |
157 | // concatenate all the arguments in one string, but have a space before and after it |
159 | wcscpy_s (text_buffer, WCHAR_SIZEOF (text_buffer), L" "); |
- | |
160 | va_start (argptr, fmt); |
- | |
161 |
|
158 | swprintf_s (text_buffer, WCHAR_SIZEOF (text_buffer), L" %s ", message); |
162 | va_end (argptr); |
- | |
163 | wcscat_s (text_buffer, WCHAR_SIZEOF (text_buffer), L" "); |
- | |
164 | 159 | ||
165 | // as long as there are smilies in this text, replace them with their equivalent data |
160 | // as long as there are smilies in this text, replace them with their equivalent data |
166 | for (smiley_index = 0; smiley_index < smiley_count; smiley_index++) |
161 | for (smiley_index = 0; smiley_index < smiley_count; smiley_index++) |
167 | { |
162 | { |
168 | smiley = &smilies[smiley_index]; // quick access to smiley |
163 | smiley = &smilies[smiley_index]; // quick access to smiley |