summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-19 17:59:03 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-19 17:59:03 +0000
commit6a519f13155c9012db6fb95f7f48a74029d6e3d2 (patch)
tree140d3e46bc2786d96eff7a2366fa61740331b4b5 /src
parent32f40b0ecb51fe9bee56e4f7ce2476c4cff53bed (diff)
minor code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@2379 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/modules/extraicons/CallbackExtraIcon.cpp4
-rw-r--r--src/modules/extraicons/CallbackExtraIcon.h1
-rw-r--r--src/modules/extraicons/DefaultExtraIcons.cpp6
-rw-r--r--src/modules/extraicons/ExtraIcon.h2
-rw-r--r--src/modules/extraicons/ExtraIconGroup.cpp4
-rw-r--r--src/modules/extraicons/ExtraIconGroup.h1
-rw-r--r--src/modules/extraicons/IcolibExtraIcon.cpp16
-rw-r--r--src/modules/extraicons/usedIcons.cpp4
8 files changed, 11 insertions, 27 deletions
diff --git a/src/modules/extraicons/CallbackExtraIcon.cpp b/src/modules/extraicons/CallbackExtraIcon.cpp
index 8c07bfd327..ce99b1b3d0 100644
--- a/src/modules/extraicons/CallbackExtraIcon.cpp
+++ b/src/modules/extraicons/CallbackExtraIcon.cpp
@@ -72,7 +72,3 @@ int CallbackExtraIcon::setIconByName(int id, HANDLE hContact, const char *icon)
{
return -1;
}
-
-void CallbackExtraIcon::storeIcon(HANDLE hContact, void *icon)
-{
-}
diff --git a/src/modules/extraicons/CallbackExtraIcon.h b/src/modules/extraicons/CallbackExtraIcon.h
index b339ce53d3..0434f91aeb 100644
--- a/src/modules/extraicons/CallbackExtraIcon.h
+++ b/src/modules/extraicons/CallbackExtraIcon.h
@@ -36,7 +36,6 @@ public:
virtual int setIcon(int id, HANDLE hContact, HANDLE icon);
virtual int setIconByName(int id, HANDLE hContact, const char* icon);
- virtual void storeIcon(HANDLE hContact, void *icon);
private:
int(*RebuildIcons)(WPARAM wParam, LPARAM lParam);
diff --git a/src/modules/extraicons/DefaultExtraIcons.cpp b/src/modules/extraicons/DefaultExtraIcons.cpp
index 5e5c3da926..872c5915cc 100644
--- a/src/modules/extraicons/DefaultExtraIcons.cpp
+++ b/src/modules/extraicons/DefaultExtraIcons.cpp
@@ -113,10 +113,8 @@ static void SetGender(HANDLE hContact, int gender, BOOL clear)
else
ico = NULL;
- if (ico == NULL && !clear)
- return;
-
- ExtraIcon_SetIcon(hExtraGender, hContact, ico);
+ if (ico != NULL || clear)
+ ExtraIcon_SetIcon(hExtraGender, hContact, ico);
}
static void EmailOnClick(Info *info, const char *text);
diff --git a/src/modules/extraicons/ExtraIcon.h b/src/modules/extraicons/ExtraIcon.h
index 0fec56562c..576b330dea 100644
--- a/src/modules/extraicons/ExtraIcon.h
+++ b/src/modules/extraicons/ExtraIcon.h
@@ -37,7 +37,7 @@ public:
virtual int setIcon(int id, HANDLE hContact, HANDLE icon) = 0;
virtual int setIconByName(int id, HANDLE hContact, const char* icon) = 0;
- virtual void storeIcon(HANDLE hContact, void *icon) = 0;
+ virtual void storeIcon(HANDLE hContact, void *icon) {};
virtual const char *getName() const;
virtual const TCHAR *getDescription() const = 0;
diff --git a/src/modules/extraicons/ExtraIconGroup.cpp b/src/modules/extraicons/ExtraIconGroup.cpp
index 0f9e162877..a7ba24d7bd 100644
--- a/src/modules/extraicons/ExtraIconGroup.cpp
+++ b/src/modules/extraicons/ExtraIconGroup.cpp
@@ -190,10 +190,6 @@ int ExtraIconGroup::internalSetIcon(int id, HANDLE hContact, void *value, bool b
return ret;
}
-void ExtraIconGroup::storeIcon(HANDLE hContact, void *icon)
-{
-}
-
const TCHAR *ExtraIconGroup::getDescription() const
{
return description.c_str();
diff --git a/src/modules/extraicons/ExtraIconGroup.h b/src/modules/extraicons/ExtraIconGroup.h
index bddc3bed5e..24671d07d8 100644
--- a/src/modules/extraicons/ExtraIconGroup.h
+++ b/src/modules/extraicons/ExtraIconGroup.h
@@ -40,7 +40,6 @@ public:
virtual int setIcon(int id, HANDLE hContact, HANDLE icon);
virtual int setIconByName(int id, HANDLE hContact, const char* icon);
- virtual void storeIcon(HANDLE hContact, void *icon);
virtual const TCHAR *getDescription() const;
virtual const char *getDescIcon() const;
diff --git a/src/modules/extraicons/IcolibExtraIcon.cpp b/src/modules/extraicons/IcolibExtraIcon.cpp
index 53d627da9e..323f47bcba 100644
--- a/src/modules/extraicons/IcolibExtraIcon.cpp
+++ b/src/modules/extraicons/IcolibExtraIcon.cpp
@@ -82,7 +82,7 @@ int IcolibExtraIcon::setIcon(int id, HANDLE hContact, HANDLE hIcoLib)
}
}
- storeIcon(hContact, hIcoLib);
+ storeIcon(hContact, "");
if (isEnabled()) {
HANDLE hImage;
@@ -115,16 +115,14 @@ int IcolibExtraIcon::setIconByName(int id, HANDLE hContact, const char *icon)
}
}
- storeIcon(hContact, "");
+ storeIcon(hContact, (char*)icon);
if (isEnabled()) {
- const char *icolibName = (const char *) icon;
-
HANDLE hImage;
- if ( IsEmpty(icolibName))
+ if ( IsEmpty(icon))
hImage = INVALID_HANDLE_VALUE;
else
- hImage = AddIcon(icolibName);
+ hImage = AddIcon(icon);
return ClistSetExtraIcon(hContact, hImage);
}
@@ -139,7 +137,7 @@ void IcolibExtraIcon::storeIcon(HANDLE hContact, void *icon)
const char *icolibName = (const char *) icon;
if ( IsEmpty(icolibName))
- icolibName = ""; // Delete doesn't work, and I don't know why
-
- db_set_s(hContact, MODULE_NAME, name.c_str(), icolibName);
+ db_unset(hContact, MODULE_NAME, name.c_str());
+ else
+ db_set_s(hContact, MODULE_NAME, name.c_str(), icolibName);
}
diff --git a/src/modules/extraicons/usedIcons.cpp b/src/modules/extraicons/usedIcons.cpp
index e810dd1878..e36fac7d96 100644
--- a/src/modules/extraicons/usedIcons.cpp
+++ b/src/modules/extraicons/usedIcons.cpp
@@ -117,10 +117,8 @@ HANDLE AddIcon(HANDLE hIcolib)
void RemoveIcon(const char *icolibName)
{
- for (unsigned int i = 0; i < usedIcons.size(); i++)
- {
+ for (unsigned int i = 0; i < usedIcons.size(); i++) {
Icon *icon = &usedIcons[i];
-
if (icon->name != icolibName)
continue;