diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/AssocMgr/src/reg.cpp | 54 | ||||
-rw-r--r-- | plugins/IEView/src/HistoryHTMLBuilder.cpp | 4 | ||||
-rw-r--r-- | plugins/IEView/src/Options.cpp | 19 | ||||
-rw-r--r-- | plugins/IEView/src/ScriverHTMLBuilder.cpp | 4 | ||||
-rw-r--r-- | plugins/IEView/src/TabSRMMHTMLBuilder.cpp | 6 | ||||
-rw-r--r-- | plugins/IEView/src/Template.cpp | 32 | ||||
-rw-r--r-- | plugins/IEView/src/Template.h | 37 |
7 files changed, 80 insertions, 76 deletions
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp index be921d8c3a..c285c65221 100644 --- a/plugins/AssocMgr/src/reg.cpp +++ b/plugins/AssocMgr/src/reg.cpp @@ -535,37 +535,39 @@ static void DeleteRegTreeBackup(const char *pszSubKey,const char *pszDbPrefix) void CleanupRegTreeBackupSettings(void)
{
+ /* delete old bak_* settings and try to restore backups */
int nSettingsCount;
char **ppszSettings;
- char *pszClassName,*pszBuf,*pszFileExt;
- int i,j;
-
- /* delete old bak_* settings and try to restore backups */
- if (EnumDbPrefixSettings("AssocMgr","bak_",&ppszSettings,&nSettingsCount)) {
- for(i=0;i<nSettingsCount;++i) {
- pszClassName=&ppszSettings[i][4];
- pszBuf=strchr(pszClassName,'\\');
- if (pszBuf!=NULL) {
- *pszBuf='\0';
- /* remove others in list with same class name */
- for(j=i;j<nSettingsCount;++j) {
- pszBuf=strchr(&ppszSettings[j][4],'\\');
- if (pszBuf!=NULL) *pszBuf='\0';
- if (lstrcmpA(pszClassName,&ppszSettings[j][4])) continue;
- MoveMemory(&ppszSettings[j],&ppszSettings[j+1],((--nSettingsCount)-j)*sizeof(TCHAR*));
- --j; /* reiterate current index */
- }
- /* no longer registered? */
- if (!IsRegisteredAssocItem(pszClassName)) {
- if (IsFileClassName(pszClassName,&pszFileExt))
- RemoveRegFileExt(pszFileExt,pszClassName);
- else RemoveRegClass(pszClassName);
- }
+ if ( !EnumDbPrefixSettings("AssocMgr", "bak_", &ppszSettings, &nSettingsCount))
+ return;
+
+ for(int i=0; i < nSettingsCount; ++i) {
+ char *pszClassName = &ppszSettings[i][4];
+ char *pszBuf = strchr(pszClassName,'\\');
+ if (pszBuf != NULL) {
+ *pszBuf = '\0';
+ /* remove others in list with same class name */
+ for(int j=i; j < nSettingsCount; ++j) {
+ pszBuf = strchr(&ppszSettings[j][4],'\\');
+ if (pszBuf != NULL) *pszBuf='\0';
+ if ( lstrcmpA(pszClassName, &ppszSettings[j][4])) continue;
+
+ mir_free(ppszSettings[j]);
+ MoveMemory(&ppszSettings[j],&ppszSettings[j+1],((--nSettingsCount)-j)*sizeof(TCHAR*));
+ --j; /* reiterate current index */
+ }
+ /* no longer registered? */
+ if ( !IsRegisteredAssocItem(pszClassName)) {
+ char *pszFileExt;
+ if ( IsFileClassName(pszClassName, &pszFileExt))
+ RemoveRegFileExt(pszFileExt, pszClassName);
+ else
+ RemoveRegClass(pszClassName);
}
- mir_free(ppszSettings[i]);
}
- mir_free(ppszSettings);
+ mir_free(ppszSettings[i]);
}
+ mir_free(ppszSettings);
}
/************************* Opera Support **************************/
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp index 7519023438..f5870f19ef 100644 --- a/plugins/IEView/src/HistoryHTMLBuilder.cpp +++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp @@ -226,8 +226,8 @@ void HistoryHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event for (int eventIdx = 0; eventData!=NULL && (eventIdx < event->count || event->count==-1); eventData = eventData->next, eventIdx++) {
int outputSize;
char *output = NULL;
- int isSent = eventData->dwFlags & IEEDF_SENT;
- int isRTL = eventData->dwFlags & IEEDF_RTL;
+ bool isSent = (eventData->dwFlags & IEEDF_SENT) != 0;
+ bool isRTL = (eventData->dwFlags & IEEDF_RTL) != 0;
if (eventData->iType == IEED_EVENT_MESSAGE || eventData->iType == IEED_EVENT_STATUSCHANGE ||
eventData->iType == IEED_EVENT_URL || eventData->iType == IEED_EVENT_FILE)
{
diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp index d5df0ca6c3..ecde244899 100644 --- a/plugins/IEView/src/Options.cpp +++ b/plugins/IEView/src/Options.cpp @@ -644,7 +644,7 @@ static INT_PTR CALLBACK IEViewSRMMOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar ProtocolSettings *proto = (ProtocolSettings *)GetItemParam((HWND)wParam, (HTREEITEM) lParam);
if (proto != NULL)
if (strcmpi(proto->getProtocolName(), "_default_"))
- proto->setSRMMEnableTemp( TreeView_GetCheckState((HWND)wParam, (HTREEITEM) lParam));
+ proto->setSRMMEnableTemp(0 != TreeView_GetCheckState((HWND)wParam, (HTREEITEM) lParam));
if ((HTREEITEM) lParam != TreeView_GetSelection((HWND)wParam))
TreeView_SelectItem((HWND)wParam, (HTREEITEM) lParam);
@@ -777,7 +777,7 @@ static INT_PTR CALLBACK IEViewHistoryOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w ProtocolSettings *proto = (ProtocolSettings *)GetItemParam((HWND)wParam, (HTREEITEM) lParam);
if (proto != NULL)
if (strcmpi(proto->getProtocolName(), "_default_"))
- proto->setHistoryEnableTemp(TreeView_GetCheckState((HWND)wParam, (HTREEITEM) lParam));
+ proto->setHistoryEnableTemp(0 != TreeView_GetCheckState((HWND)wParam, (HTREEITEM) lParam));
if ((HTREEITEM) lParam != TreeView_GetSelection((HWND)wParam))
TreeView_SelectItem((HWND)wParam, (HTREEITEM) lParam);
@@ -911,7 +911,7 @@ static INT_PTR CALLBACK IEViewGroupChatsOptDlgProc(HWND hwndDlg, UINT msg, WPARA ProtocolSettings *proto = (ProtocolSettings *)GetItemParam((HWND)wParam, (HTREEITEM) lParam);
if (proto != NULL)
if (strcmpi(proto->getProtocolName(), "_default_"))
- proto->setChatEnableTemp(TreeView_GetCheckState((HWND)wParam, (HTREEITEM) lParam));
+ proto->setChatEnableTemp(0 != TreeView_GetCheckState((HWND)wParam, (HTREEITEM) lParam));
if ((HTREEITEM) lParam != TreeView_GetSelection((HWND)wParam)) {
TreeView_SelectItem((HWND)wParam, (HTREEITEM) lParam);
@@ -1495,7 +1495,7 @@ void Options::init() }
/* SRMM settings */
mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_ENABLE);
- proto->setSRMMEnable(i==0 ? true : db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
+ proto->setSRMMEnable(i==0 ? true : 0 != db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_MODE);
proto->setSRMMMode(db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_SRMM_FLAGS);
@@ -1528,7 +1528,7 @@ void Options::init() /* Group chat settings */
mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_ENABLE);
- proto->setChatEnable(i==0 ? true : db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
+ proto->setChatEnable(i==0 ? true : 0 != db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_MODE);
proto->setChatMode(db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_CHAT_FLAGS);
@@ -1561,7 +1561,7 @@ void Options::init() /* History settings */
mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_ENABLE);
- proto->setHistoryEnable(i==0 ? true : db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
+ proto->setHistoryEnable(i==0 ? true : 0 != db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_MODE);
proto->setHistoryMode(db_get_b(NULL, ieviewModuleName, dbsName, FALSE));
mir_snprintf(dbsName, SIZEOF(dbsName), "%s.%s", proto->getProtocolName(), DBS_HISTORY_FLAGS);
@@ -1600,8 +1600,8 @@ void Options::init() lastProto = proto;
}
- bMathModule = (bool) ServiceExists(MTH_GET_GIF_UNICODE);
- bSmileyAdd = (bool) ServiceExists(MS_SMILEYADD_BATCHPARSE);
+ bMathModule = 0 != ServiceExists(MTH_GET_GIF_UNICODE);
+ bSmileyAdd = 0 != ServiceExists(MS_SMILEYADD_BATCHPARSE);
avatarServiceFlags = 0;
if (ServiceExists(MS_AV_GETAVATARBITMAP))
avatarServiceFlags = AVATARSERVICE_PRESENT;
@@ -1614,6 +1614,7 @@ void Options::uninit() p1 = p->getNext();
delete p;
}
+ TemplateMap::dropTemplates();
if (hImageList != NULL)
ImageList_Destroy(hImageList);
if (hProtocolImageList != NULL)
@@ -1626,7 +1627,7 @@ void Options::setGeneralFlags(int flags) db_set_dw(NULL, ieviewModuleName, DBS_BASICFLAGS, (DWORD) flags);
}
-int Options::getGeneralFlags()
+int Options::getGeneralFlags()
{
return generalFlags;
}
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index 6aa5f904e9..25b96f76f7 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -287,8 +287,8 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event int outputSize;
char *output;
output = NULL;
- int isSent = eventData->dwFlags & IEEDF_SENT;
- int isRTL = eventData->dwFlags & IEEDF_RTL;
+ bool isSent = (eventData->dwFlags & IEEDF_SENT) != 0;
+ bool isRTL = (eventData->dwFlags & IEEDF_RTL) != 0;
showColon = false;
if (eventData->iType == IEED_EVENT_MESSAGE || eventData->iType == IEED_EVENT_STATUSCHANGE ||
eventData->iType == IEED_EVENT_URL || eventData->iType == IEED_EVENT_FILE)
diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp index 41bd1680b9..bbdbd497c9 100644 --- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp +++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp @@ -315,9 +315,9 @@ void TabSRMMHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event int outputSize;
char *output = NULL;
if (eventData->iType == IEED_EVENT_MESSAGE || eventData->iType == IEED_EVENT_FILE || eventData->iType == IEED_EVENT_URL || eventData->iType == IEED_EVENT_STATUSCHANGE) {
- int isGroupBreak = TRUE;
- int isSent = (eventData->dwFlags & IEEDF_SENT);
- int isRTL = eventData->dwFlags & IEEDF_RTL;
+ bool isGroupBreak = true;
+ bool isSent = (eventData->dwFlags & IEEDF_SENT) != 0;
+ bool isRTL = (eventData->dwFlags & IEEDF_RTL) != 0;
int isHistory = (eventData->time < (DWORD)getStartedTime() && (eventData->dwFlags & IEEDF_READ || eventData->dwFlags & IEEDF_SENT));
if (dwFlags & MWF_LOG_GROUPMODE && eventData->dwFlags == LOWORD(getLastEventType()) &&
eventData->iType == IEED_EVENT_MESSAGE && HIWORD(getLastEventType()) == IEED_EVENT_MESSAGE &&
diff --git a/plugins/IEView/src/Template.cpp b/plugins/IEView/src/Template.cpp index 20a3dd2cc9..158249762f 100644 --- a/plugins/IEView/src/Template.cpp +++ b/plugins/IEView/src/Template.cpp @@ -42,10 +42,7 @@ Token::Token(int type, const char *text, int escape) next = NULL;
this->type = type;
this->escape = escape;
- if (text!=NULL)
- this->text = mir_strdup(text);
- else
- this->text = NULL;
+ this->text = mir_strdup(text);
}
Token::~Token()
@@ -373,10 +370,7 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, if (wasTemplate)
tmap->addTemplate(lastTemplate, templateText);
- if (templateText != NULL)
- free (templateText);
-
- templateText = NULL;
+ replaceStr(templateText, NULL);
templateTextSize = 0;
wasTemplate = true;
sscanf(store, "<!--%[^-]", lastTemplate);
@@ -386,6 +380,7 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, }
if (wasTemplate)
tmap->addTemplate(lastTemplate, templateText);
+ replaceStr(templateText, NULL);
fclose(fh);
static const char *groupTemplates[] = {"MessageInGroupStart", "MessageInGroupInner",
@@ -429,19 +424,18 @@ Template* TemplateMap::getTemplate(const char *text) return 0;
}
-Template* TemplateMap::getTemplate(const char *proto, const char *text) {
- TemplateMap *ptr;
- for (ptr=mapList; ptr!=NULL; ptr=ptr->next) {
- if (!strcmp(ptr->name, proto)) {
+Template* TemplateMap::getTemplate(const char *proto, const char *text)
+{
+ for (TemplateMap *ptr = mapList; ptr != NULL; ptr = ptr->next)
+ if (!strcmp(ptr->name, proto))
return ptr->getTemplate(text);
- }
- }
+
return NULL;
}
TemplateMap* TemplateMap::getTemplateMap(const char *proto)
{
- for (TemplateMap *ptr=mapList; ptr != NULL; ptr = ptr->next)
+ for (TemplateMap *ptr = mapList; ptr != NULL; ptr = ptr->next)
if (!strcmp(ptr->name, proto))
return ptr;
@@ -464,4 +458,10 @@ TemplateMap* TemplateMap::loadTemplates(const char *id, const char *filename, bo return loadTemplateFile(id, filename, onlyInfo);
}
-
+void TemplateMap::dropTemplates()
+{
+ for (TemplateMap *p = mapList, *p1; p != NULL; p = p1) {
+ p1 = p->next;
+ delete p;
+ }
+}
diff --git a/plugins/IEView/src/Template.h b/plugins/IEView/src/Template.h index 5f0f3c5626..a0a3c51dd7 100644 --- a/plugins/IEView/src/Template.h +++ b/plugins/IEView/src/Template.h @@ -96,28 +96,29 @@ public: class TemplateMap {
private:
static TemplateMap *mapList;
- char * name;
- char * filename;
- bool grouping;
- bool rtl;
- Template * entries;
- TemplateMap * next;
+ char *name;
+ char *filename;
+ bool grouping;
+ bool rtl;
+ Template *entries;
+ TemplateMap *next;
TemplateMap(const char *name);
- void addTemplate(const char *name, const char *text);
- void setFilename(const char *filename);
- void clear();
- static TemplateMap* add(const char *id, const char *filename);
- static void appendText(char **str, int *sizeAlloced, const char *fmt, ...);
- static TemplateMap* loadTemplateFile(const char *proto, const char *filename, bool onlyInfo);
+ void addTemplate(const char *name, const char *text);
+ void setFilename(const char *filename);
+ void clear();
+ static TemplateMap* add(const char *id, const char *filename);
+ static void appendText(char **str, int *sizeAlloced, const char *fmt, ...);
+ static TemplateMap* loadTemplateFile(const char *proto, const char *filename, bool onlyInfo);
public:
~TemplateMap();
- static Template * getTemplate(const char *id, const char *name);
- static TemplateMap *getTemplateMap(const char *id);
+ static Template* getTemplate(const char *id, const char *name);
+ static TemplateMap* getTemplateMap(const char *id);
static TemplateMap* loadTemplates(const char *id, const char *filename, bool onlyInfo);
- Template * getTemplate(const char *text);
- const char * getFilename();
- bool isGrouping();
- bool isRTL();
+ static void dropTemplates();
+ Template* getTemplate(const char *text);
+ const char* getFilename();
+ bool isGrouping();
+ bool isRTL();
};
|