summaryrefslogtreecommitdiff
path: root/IEView/MUCCHTMLBuilder.cpp
diff options
context:
space:
mode:
authormataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2012-02-08 15:49:08 +0000
committermataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb>2012-02-08 15:49:08 +0000
commit637559f4c7bcd3f9780b5e343b86cbad3b13d967 (patch)
treed553760204dd1f23354b16de6fbff10e5f9d14b9 /IEView/MUCCHTMLBuilder.cpp
parentf18e643d7c4ba4f2758525778d9318bdda784a1b (diff)
IEView:
code formating git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@270 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'IEView/MUCCHTMLBuilder.cpp')
-rw-r--r--IEView/MUCCHTMLBuilder.cpp138
1 files changed, 69 insertions, 69 deletions
diff --git a/IEView/MUCCHTMLBuilder.cpp b/IEView/MUCCHTMLBuilder.cpp
index 64bb4d6..45e7f21 100644
--- a/IEView/MUCCHTMLBuilder.cpp
+++ b/IEView/MUCCHTMLBuilder.cpp
@@ -42,60 +42,60 @@ MUCCHTMLBuilder::MUCCHTMLBuilder() {
}
void MUCCHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) {
- char str[32];
- int style;
- DBVARIANT dbv;
- if (colour) {
- wsprintfA(str, "Font%dCol", i);
- *colour = DBGetContactSettingDword(NULL, MUCCMOD, str, 0x000000);
- }
- if (lf) {
- wsprintfA(str, "Font%dSize", i);
- lf->lfHeight = (char) DBGetContactSettingByte(NULL, MUCCMOD, str, 10);
- lf->lfHeight = abs(lf->lfHeight);
- lf->lfWidth = 0;
- lf->lfEscapement = 0;
- lf->lfOrientation = 0;
- wsprintfA(str, "Font%dStyle", i);
- style = DBGetContactSettingByte(NULL, MUCCMOD, str, 0);
- lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
- lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
- lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
- lf->lfStrikeOut = 0;
- wsprintfA(str, "Font%dSet", i);
- lf->lfCharSet = DBGetContactSettingByte(NULL, MUCCMOD, str, DEFAULT_CHARSET);
- lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
- lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
- lf->lfQuality = DEFAULT_QUALITY;
- lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
- wsprintfA(str, "Font%dFace", i);
- if (DBGetContactSetting(NULL, MUCCMOD, str, &dbv))
- lstrcpyA(lf->lfFaceName, "Verdana");
- else {
- lstrcpynA(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
- DBFreeVariant(&dbv);
- }
- }
+ char str[32];
+ int style;
+ DBVARIANT dbv;
+ if (colour) {
+ wsprintfA(str, "Font%dCol", i);
+ *colour = DBGetContactSettingDword(NULL, MUCCMOD, str, 0x000000);
+ }
+ if (lf) {
+ wsprintfA(str, "Font%dSize", i);
+ lf->lfHeight = (char) DBGetContactSettingByte(NULL, MUCCMOD, str, 10);
+ lf->lfHeight = abs(lf->lfHeight);
+ lf->lfWidth = 0;
+ lf->lfEscapement = 0;
+ lf->lfOrientation = 0;
+ wsprintfA(str, "Font%dStyle", i);
+ style = DBGetContactSettingByte(NULL, MUCCMOD, str, 0);
+ lf->lfWeight = style & FONTF_BOLD ? FW_BOLD : FW_NORMAL;
+ lf->lfItalic = style & FONTF_ITALIC ? 1 : 0;
+ lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0;
+ lf->lfStrikeOut = 0;
+ wsprintfA(str, "Font%dSet", i);
+ lf->lfCharSet = DBGetContactSettingByte(NULL, MUCCMOD, str, DEFAULT_CHARSET);
+ lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
+ lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
+ lf->lfQuality = DEFAULT_QUALITY;
+ lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
+ wsprintfA(str, "Font%dFace", i);
+ if (DBGetContactSetting(NULL, MUCCMOD, str, &dbv))
+ lstrcpyA(lf->lfFaceName, "Verdana");
+ else {
+ lstrcpynA(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
+ DBFreeVariant(&dbv);
+ }
+ }
}
char *MUCCHTMLBuilder::timestampToString(DWORD dwData, time_t check)
{
- static char szResult[512];
- char str[80];
+ static char szResult[512];
+ char str[80];
- DBTIMETOSTRING dbtts;
+ DBTIMETOSTRING dbtts;
- dbtts.cbDest = 70;;
- dbtts.szDest = str;
+ dbtts.cbDest = 70;;
+ dbtts.szDest = str;
szResult[0] = '\0';
struct tm tm_now, tm_today;
time_t now = time(NULL);
time_t today;
- tm_now = *localtime(&now);
- tm_today = tm_now;
- tm_today.tm_hour = tm_today.tm_min = tm_today.tm_sec = 0;
- today = mktime(&tm_today);
+ tm_now = *localtime(&now);
+ tm_today = tm_now;
+ tm_today.tm_hour = tm_today.tm_min = tm_today.tm_sec = 0;
+ today = mktime(&tm_today);
if (dwData&IEEDD_MUCC_SHOW_DATE && dwData&IEEDD_MUCC_SHOW_TIME) {
if (dwData&IEEDD_MUCC_LONG_DATE) {
dbtts.szFormat = dwData&IEEDD_MUCC_SECONDS ? (char *)"D s" : (char *)"D t";
@@ -110,9 +110,9 @@ char *MUCCHTMLBuilder::timestampToString(DWORD dwData, time_t check)
dbtts.szFormat = (char *)"";
}
CallService(MS_DB_TIME_TIMESTAMPTOSTRING, check, (LPARAM) & dbtts);
- strncat(szResult, str, 500);
+ strncat(szResult, str, 500);
Utils::UTF8Encode(szResult, szResult, 500);
- return szResult;
+ return szResult;
}
void MUCCHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) {
@@ -130,23 +130,23 @@ void MUCCHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) {
}
if (protoSettings->getChatMode() == Options::MODE_CSS) {
const char *externalCSS = protoSettings->getChatCssFilename();
- Utils::appendText(&output, &outputSize, "<html><head><link rel=\"stylesheet\" href=\"%s\"/></head><body class=\"body\">\n", externalCSS);
+ Utils::appendText(&output, &outputSize, "<html><head><link rel=\"stylesheet\" href=\"%s\"/></head><body class=\"body\">\n", externalCSS);
} else {
HDC hdc = GetDC(NULL);
- int logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
+ int logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(NULL, hdc);
Utils::appendText(&output, &outputSize, "<html><head>");
Utils::appendText(&output, &outputSize, "<style type=\"text/css\">\n");
COLORREF bkgColor = DBGetContactSettingDword(NULL, MUCCMOD, "BackgroundLog", 0xFFFFFF);
COLORREF inColor, outColor;
- bkgColor= (((bkgColor & 0xFF) << 16) | (bkgColor & 0xFF00) | ((bkgColor & 0xFF0000) >> 16));
+ bkgColor= (((bkgColor & 0xFF) << 16) | (bkgColor & 0xFF00) | ((bkgColor & 0xFF0000) >> 16));
inColor = outColor = bkgColor;
if (protoSettings->getChatFlags() & Options::LOG_IMAGE_ENABLED) {
Utils::appendText(&output, &outputSize, ".body {padding: 2px; text-align: left; background-attachment: %s; background-color: #%06X; background-image: url('%s'); overflow: auto;}\n",
protoSettings->getChatFlags() & Options::LOG_IMAGE_SCROLL ? "scroll" : "fixed", (int) bkgColor, protoSettings->getChatBackgroundFilename());
} else {
Utils::appendText(&output, &outputSize, ".body {margin: 0px; text-align: left; background-color: #%06X; overflow: auto;}\n",
- (int) bkgColor);
+ (int) bkgColor);
}
Utils::appendText(&output, &outputSize, ".link {color: #0000FF; text-decoration: underline;}\n");
Utils::appendText(&output, &outputSize, ".img {vertical-align: middle;}\n");
@@ -176,7 +176,7 @@ void MUCCHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) {
Utils::appendText(&output, &outputSize, "</style></head><body class=\"body\">\n");
}
if (output != NULL) {
- view->write(output);
+ view->write(output);
free(output);
}
setLastEventType(-1);
@@ -184,7 +184,7 @@ void MUCCHTMLBuilder::buildHead(IEView *view, IEVIEWEVENT *event) {
void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) {
- IEVIEWEVENTDATA* eventData = event->eventData;
+ IEVIEWEVENTDATA* eventData = event->eventData;
for (int eventIdx = 0; eventData!=NULL && (eventIdx < event->count || event->count==-1); eventData = eventData->next, eventIdx++) {
DWORD dwData = eventData->dwData;
char *style = NULL;
@@ -218,38 +218,38 @@ void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) {
}
const char *className = isSent ? "messageOut" : "messageIn";
if (eventData->dwFlags & IEEDF_FORMAT_SIZE && eventData->fontSize > 0) {
- Utils::appendText(&style, &styleSize, "font-size:%dpt;", eventData->fontSize);
+ Utils::appendText(&style, &styleSize, "font-size:%dpt;", eventData->fontSize);
}
if (eventData->dwFlags & IEEDF_FORMAT_COLOR && eventData->color!=0xFFFFFFFF) {
- Utils::appendText(&style, &styleSize, "color:#%06X;", ((eventData->color & 0xFF) << 16) | (eventData->color & 0xFF00) | ((eventData->color & 0xFF0000) >> 16));
+ Utils::appendText(&style, &styleSize, "color:#%06X;", ((eventData->color & 0xFF) << 16) | (eventData->color & 0xFF00) | ((eventData->color & 0xFF0000) >> 16));
}
if (eventData->dwFlags & IEEDF_FORMAT_FONT) {
- Utils::appendText(&style, &styleSize, "font-family:%s;", eventData->fontName);
+ Utils::appendText(&style, &styleSize, "font-family:%s;", eventData->fontName);
}
if (eventData->dwFlags & IEEDF_FORMAT_STYLE) {
- Utils::appendText(&style, &styleSize, "font-weight: %s;", eventData->fontStyle & IE_FONT_BOLD ? "bold" : "normal");
- Utils::appendText(&style, &styleSize, "font-style: %s;", eventData->fontStyle & IE_FONT_ITALIC ? "italic" : "normal");
- Utils::appendText(&style, &styleSize, "text-decoration: %s;", eventData->fontStyle & IE_FONT_UNDERLINE ? "underline" : "none");
+ Utils::appendText(&style, &styleSize, "font-weight: %s;", eventData->fontStyle & IE_FONT_BOLD ? "bold" : "normal");
+ Utils::appendText(&style, &styleSize, "font-style: %s;", eventData->fontStyle & IE_FONT_ITALIC ? "italic" : "normal");
+ Utils::appendText(&style, &styleSize, "text-decoration: %s;", eventData->fontStyle & IE_FONT_UNDERLINE ? "underline" : "none");
}
Utils::appendText(&output, &outputSize, "<span class=\"%s\"><span style=\"%s\">%s</span></span>", className, style!=NULL ? style : "", szText);
- Utils::appendText(&output, &outputSize, "</div>\n");
+ Utils::appendText(&output, &outputSize, "</div>\n");
if (style!=NULL) free(style);
} else if (eventData->iType == IEED_MUCC_EVENT_JOINED || eventData->iType == IEED_MUCC_EVENT_LEFT || eventData->iType == IEED_MUCC_EVENT_TOPIC) {
const char *className, *divName;
const char *eventText;
if (eventData->iType == IEED_MUCC_EVENT_JOINED) {
- className = "userJoined";
- divName = "divUserJoined";
+ className = "userJoined";
+ divName = "divUserJoined";
eventText = "%s has joined.";
szText = encodeUTF8(NULL, event->pszProto, eventData->pszNick, ENF_NONE, isSent);
} else if (eventData->iType == IEED_MUCC_EVENT_LEFT) {
- className = "userLeft";
- divName = "divUserJoined";
+ className = "userLeft";
+ divName = "divUserJoined";
eventText = "%s has left.";
szText = encodeUTF8(NULL, event->pszProto, eventData->pszNick, ENF_NONE, isSent);
} else {
- className = "topicChange";
- divName = "divTopicChange";
+ className = "topicChange";
+ divName = "divTopicChange";
eventText = "The topic is %s.";
szText = encodeUTF8(NULL, event->pszProto, eventData->pszText, ENF_ALL, isSent);
}
@@ -261,21 +261,21 @@ void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) {
Utils::appendText(&output, &outputSize, "<span class=\"%s\">", className);
Utils::appendText(&output, &outputSize, Translate(eventText), szText);
Utils::appendText(&output, &outputSize, "</span>");
- Utils::appendText(&output, &outputSize, "</div>\n");
+ Utils::appendText(&output, &outputSize, "</div>\n");
} else if (eventData->iType == IEED_MUCC_EVENT_ERROR) {
- const char *className = "error";
+ const char *className = "error";
szText = encodeUTF8(NULL, event->pszProto, eventData->pszText, ENF_NONE, isSent);
Utils::appendText(&output, &outputSize, "<div class=\"%s\">", "divError");
Utils::appendText(&output, &outputSize, "<span class=\"%s\"> %s: %s</span>", className, Translate("Error"), szText);
- Utils::appendText(&output, &outputSize, "</div>\n");
+ Utils::appendText(&output, &outputSize, "</div>\n");
}
if (szName!=NULL) delete szName;
if (szText!=NULL) delete szText;
if (output != NULL) {
- view->write(output);
+ view->write(output);
free(output);
}
- }
+ }
// view->scrollToBottom();
}