mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Show fingerprints with colons
This commit is contained in:
@@ -184,6 +184,8 @@ CString::EEscape CString::ToEscape(const CString& sEsc) {
|
||||
return EDEBUG;
|
||||
} else if (sEsc.Equals("MSGTAG")) {
|
||||
return EMSGTAG;
|
||||
} else if (sEsc.Equals("HEXCOLON")) {
|
||||
return EHEXCOLON;
|
||||
}
|
||||
|
||||
return EASCII;
|
||||
@@ -350,6 +352,35 @@ CString CString::Escape_n(EEscape eFrom, EEscape eTo) const {
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case EHEXCOLON: {
|
||||
while (!isxdigit(*p) && a < iLength) {
|
||||
a++;
|
||||
p++;
|
||||
}
|
||||
if (a == iLength) {
|
||||
continue;
|
||||
}
|
||||
if (isdigit(*p)) {
|
||||
ch = (unsigned char)((*p - '0') << 4);
|
||||
} else {
|
||||
ch = (unsigned char)((tolower(*p) - 'a' +10) << 4);
|
||||
}
|
||||
a++;
|
||||
p++;
|
||||
while (!isxdigit(*p) && a < iLength) {
|
||||
a++;
|
||||
p++;
|
||||
}
|
||||
if (a == iLength) {
|
||||
continue;
|
||||
}
|
||||
if (isdigit(*p)) {
|
||||
ch |= (unsigned char)(*p - '0');
|
||||
} else {
|
||||
ch |= (unsigned char)(tolower(*p) - 'a' +10);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -419,11 +450,20 @@ CString CString::Escape_n(EEscape eFrom, EEscape eTo) const {
|
||||
} else if (ch == '\n') { sRet += '\\'; sRet += 'n';
|
||||
} else { sRet += ch; }
|
||||
|
||||
break;
|
||||
case EHEXCOLON: {
|
||||
sRet += tolower(szHex[ch >> 4]);
|
||||
sRet += tolower(szHex[ch & 0xf]);
|
||||
sRet += ":";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sRet.reserve(0);
|
||||
if (eTo == EHEXCOLON) {
|
||||
sRet.TrimRight(":");
|
||||
}
|
||||
|
||||
return sRet;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user