mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-06 15:53:12 +02:00
.
This commit is contained in:
+7
-52
@@ -739,20 +739,23 @@ LRESULT CALLBACK StatusDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Parse bold and underline codes, also change { and } to RTF safe \{ and \}
|
||||
* (c) 2001 codemastr & McSkaf
|
||||
*/
|
||||
|
||||
static char *ParseCodes(char *buffer)
|
||||
{
|
||||
static char tmp[512], out[512];
|
||||
int i = 0, j = 0, hascomma = 0, bold = 0, underline = 0, reverse = 0, firstcolordigit;
|
||||
int i = 0, j = 0, hascomma = 0, bold = 0, underline = 0, reverse = 0;
|
||||
|
||||
bzero((char *)out, sizeof(out));
|
||||
memcpy(tmp, buffer, 512);
|
||||
|
||||
while (tmp[i])
|
||||
{
|
||||
if (tmp[i] == '\26') {
|
||||
if (tmp[i] == '\022') {
|
||||
reverse = ~reverse;
|
||||
if (reverse) {
|
||||
strcat(out, "\\cf1\\highlight16 ");
|
||||
@@ -765,56 +768,8 @@ static char *ParseCodes(char *buffer)
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
if (tmp[i] == '\3') {
|
||||
strcat(out,"\\cf");
|
||||
j += 3;
|
||||
++i;
|
||||
firstcolordigit = 1;
|
||||
while (isdigit(tmp[i]))
|
||||
{
|
||||
if (firstcolordigit)
|
||||
{
|
||||
// need to reverse black and white color numbers
|
||||
// mirc uses 0=white, 1=black but rtf is just the opposite
|
||||
if (tmp[i] == '0')
|
||||
tmp[i] = '1';
|
||||
else if (tmp[i] == '1' && !isdigit(tmp[i+1]))
|
||||
tmp[i] = '0';
|
||||
}
|
||||
firstcolordigit = 0;
|
||||
out[j++] = tmp[i++];
|
||||
}
|
||||
// look for background color
|
||||
if (tmp[i] == ',')
|
||||
{
|
||||
// prepare for background color
|
||||
strcat(out, "\\highlight");
|
||||
j += 10;
|
||||
++i;
|
||||
firstcolordigit = 1;
|
||||
while (isdigit(tmp[i]))
|
||||
{
|
||||
if (firstcolordigit)
|
||||
{
|
||||
// need to reverse black and white color numbers
|
||||
// mirc uses 0=white, 1=black but for background colors
|
||||
// rtf uses 0=off (white), 1=white so our color table
|
||||
// specifies color number 16 as black.
|
||||
if (tmp[i] == '0') // white
|
||||
tmp[i] = '1';
|
||||
else if (tmp[i] == '1' && !isdigit(tmp[i+1])) // black
|
||||
{
|
||||
tmp[i] = '6';
|
||||
out[j++] = '1';
|
||||
}
|
||||
}
|
||||
firstcolordigit = 0;
|
||||
out[j++] = tmp[i++];
|
||||
}
|
||||
}
|
||||
out[j++] = ' ';
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (tmp[i] == '\037' || tmp[i] == '\031') {
|
||||
if (!underline) {
|
||||
strcat(out,"\\ul ");
|
||||
|
||||
Reference in New Issue
Block a user