summaryrefslogtreecommitdiff
path: root/plugins/Variables
diff options
context:
space:
mode:
authorVlad Mironov <mironych@googlemail.com>2012-07-02 02:27:39 +0000
committerVlad Mironov <mironych@googlemail.com>2012-07-02 02:27:39 +0000
commit8ff9ea222993b065a49efa138919b3e062299697 (patch)
treed8abd90f46be9390143f4ccb15ac3d069397f3c8 /plugins/Variables
parent847064757239d021d1aa612067737865d31aceb2 (diff)
Крошечная оптимизация.
git-svn-id: http://svn.miranda-ng.org/main/trunk@710 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Variables')
-rw-r--r--plugins/Variables/contact.cpp30
-rw-r--r--plugins/Variables/parse_metacontacts.cpp7
-rw-r--r--plugins/Variables/parse_miranda.cpp5
-rw-r--r--plugins/Variables/variables.h4
4 files changed, 19 insertions, 27 deletions
diff --git a/plugins/Variables/contact.cpp b/plugins/Variables/contact.cpp
index 16ef88a239..c146f4e261 100644
--- a/plugins/Variables/contact.cpp
+++ b/plugins/Variables/contact.cpp
@@ -164,7 +164,7 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
if (szProto == NULL)
return NULL;
- status = DBGetContactSettingWord(hContact, szProto, "Status", 0);
+ status = DBGetContactSettingWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);
if (status == 0)
return NULL;
@@ -300,14 +300,9 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
return res;
}
-TCHAR *getContactInfoT(BYTE type, HANDLE hContact, int tchar)
+TCHAR *getContactInfoT(BYTE type, HANDLE hContact)
{
- if (tchar)
- {
- return getContactInfo((BYTE)(type | CNF_UNICODE), hContact);
- }
-
- return getContactInfo(type, hContact);
+ return getContactInfo((BYTE)(type | CNF_UNICODE), hContact);
}
/*
@@ -374,12 +369,11 @@ int getContactFromString( CONTACTSINFO* ci )
// <proto:id> (exact)
if (ci->flags&CI_PROTOID)
{
- cInfo = getContactInfoT(CNF_UNIQUEID, hContact, ci->flags&CI_TCHAR);
+ cInfo = getContactInfoT(CNF_UNIQUEID, hContact);
if (cInfo == NULL)
{
// <HANDLE:hContact>
cInfo = (TCHAR*)mir_alloc(32);
- //cInfo = itot((INT_PTR)hContact);
_stprintf(cInfo, _T("%p"), hContact);
szFind = (TCHAR*)mir_alloc((_tcslen(cInfo) + _tcslen(_T(PROTOID_HANDLE)) + 4)*sizeof(TCHAR));
if (szFind != NULL)
@@ -415,7 +409,7 @@ int getContactFromString( CONTACTSINFO* ci )
}
// id (exact)
if ((ci->flags&CI_UNIQUEID) && (!bMatch)) {
- szFind = getContactInfoT(CNF_UNIQUEID, hContact, ci->flags&CI_TCHAR);
+ szFind = getContactInfoT(CNF_UNIQUEID, hContact);
if (szFind != NULL) {
if (!_tcscmp(tszContact, szFind))
bMatch = TRUE;
@@ -425,7 +419,7 @@ int getContactFromString( CONTACTSINFO* ci )
}
// nick (not exact)
if ((ci->flags&CI_NICK) && (!bMatch)) {
- szFind = getContactInfoT(CNF_NICK, hContact, ci->flags&CI_TCHAR);
+ szFind = getContactInfoT(CNF_NICK, hContact);
if (szFind != NULL) {
if (!_tcscmp(tszContact, szFind))
bMatch = TRUE;
@@ -435,7 +429,7 @@ int getContactFromString( CONTACTSINFO* ci )
}
// list name (not exact)
if ((ci->flags&CI_LISTNAME) && (!bMatch)) {
- szFind = getContactInfoT(CNF_DISPLAY, hContact, ci->flags&CI_TCHAR);
+ szFind = getContactInfoT(CNF_DISPLAY, hContact);
if (szFind != NULL) {
if (!_tcscmp(tszContact, szFind))
bMatch = TRUE;
@@ -445,7 +439,7 @@ int getContactFromString( CONTACTSINFO* ci )
}
// firstname (exact)
if ((ci->flags&CI_FIRSTNAME) && (!bMatch)) {
- szFind = getContactInfoT(CNF_FIRSTNAME, hContact, ci->flags&CI_TCHAR);
+ szFind = getContactInfoT(CNF_FIRSTNAME, hContact);
if (szFind != NULL) {
if (!_tcscmp(tszContact, szFind)) {
bMatch = TRUE;
@@ -455,7 +449,7 @@ int getContactFromString( CONTACTSINFO* ci )
}
// lastname (exact)
if ((ci->flags&CI_LASTNAME) && (!bMatch)) {
- szFind = getContactInfoT(CNF_LASTNAME, hContact, ci->flags&CI_TCHAR);
+ szFind = getContactInfoT(CNF_LASTNAME, hContact);
if (szFind != NULL) {
if (!_tcscmp(tszContact, szFind)) {
bMatch = TRUE;
@@ -465,7 +459,7 @@ int getContactFromString( CONTACTSINFO* ci )
}
// email (exact)
if ((ci->flags&CI_EMAIL) && (!bMatch)) {
- szFind = getContactInfoT(CNF_EMAIL, hContact, ci->flags&CI_TCHAR);
+ szFind = getContactInfoT(CNF_EMAIL, hContact);
if (szFind != NULL) {
if (!_tcscmp(tszContact, szFind)) {
bMatch = TRUE;
@@ -475,7 +469,7 @@ int getContactFromString( CONTACTSINFO* ci )
}
// CNF_ (exact)
if ((ci->flags&CI_CNFINFO) && (!bMatch)) {
- szFind = getContactInfoT((BYTE)(ci->flags&~(CI_CNFINFO|CI_TCHAR)), hContact, ci->flags&CI_TCHAR);
+ szFind = getContactInfoT((BYTE)(ci->flags&~(CI_CNFINFO|CI_TCHAR)), hContact);
if (szFind != NULL) {
if (!_tcscmp(tszContact, szFind)) {
bMatch = TRUE;
@@ -592,7 +586,7 @@ TCHAR *encodeContactToString(HANDLE hContact)
ZeroMemory(&dbv, sizeof(DBVARIANT));
szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- tszUniqueId = getContactInfoT(CNF_UNIQUEID, hContact, CI_TCHAR);
+ tszUniqueId = getContactInfoT(CNF_UNIQUEID, hContact);
if (szProto == NULL || tszUniqueId == NULL)
return NULL;
diff --git a/plugins/Variables/parse_metacontacts.cpp b/plugins/Variables/parse_metacontacts.cpp
index 341457f240..128a04a99b 100644
--- a/plugins/Variables/parse_metacontacts.cpp
+++ b/plugins/Variables/parse_metacontacts.cpp
@@ -53,7 +53,7 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai)
TCHAR* szUniqueID = NULL;
char* szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (szProto != NULL)
- szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact, 1);
+ szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
if (szUniqueID == NULL)
{
@@ -115,7 +115,7 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai)
TCHAR* szUniqueID = NULL;
char* szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (szProto != NULL)
- szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact, 1);
+ szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
@@ -176,11 +176,10 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai)
TCHAR* szUniqueID = NULL;
char* szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
if (szProto != NULL)
- szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact, 1);
+ szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
- //szUniqueID = itot((INT_PTR)hContact);
szUniqueID = (TCHAR*)mir_alloc(32);
_stprintf(szUniqueID, _T("%p"), hContact);
if (szProto == NULL || szUniqueID == NULL)
diff --git a/plugins/Variables/parse_miranda.cpp b/plugins/Variables/parse_miranda.cpp
index 201f699fbf..926f7fb67b 100644
--- a/plugins/Variables/parse_miranda.cpp
+++ b/plugins/Variables/parse_miranda.cpp
@@ -147,7 +147,7 @@ static TCHAR *parseContactInfo(ARGUMENTSINFO *ai)
if (type == 0)
return NULL;
- return getContactInfoT(type, hContact, 1);
+ return getContactInfoT(type, hContact);
}
static TCHAR *parseDBProfileName(ARGUMENTSINFO *ai)
@@ -478,11 +478,10 @@ static TCHAR *parseSpecialContact(ARGUMENTSINFO *ai)
TCHAR *szUniqueID = NULL;
char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ai->fi->hContact, 0);
if (szProto != NULL)
- szUniqueID = getContactInfoT(CNF_UNIQUEID, ai->fi->hContact, 1);
+ szUniqueID = getContactInfoT(CNF_UNIQUEID, ai->fi->hContact);
if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
- //szUniqueID = itot((INT_PTR)ai->fi->hContact);
szUniqueID = (TCHAR*)mir_alloc(32);
_stprintf(szUniqueID, _T("%p"), ai->fi->hContact);
if (szProto == NULL || szUniqueID == NULL)
diff --git a/plugins/Variables/variables.h b/plugins/Variables/variables.h
index 68ac51aa3a..35b5e2f367 100644
--- a/plugins/Variables/variables.h
+++ b/plugins/Variables/variables.h
@@ -125,7 +125,7 @@ int initTokenRegister();
int deinitTokenRegister();
// contact.c
BYTE getContactInfoType(TCHAR* type);
-TCHAR* getContactInfoT(BYTE type, HANDLE hContact, int tchar);
+TCHAR* getContactInfoT(BYTE type, HANDLE hContact);
int getContactFromString( CONTACTSINFO* );
int initContactModule();
int deinitContactModule();
@@ -170,4 +170,4 @@ int iconsChanged(WPARAM wParam, LPARAM lParam);
int ttoi(TCHAR *string);
TCHAR *itot(int num);
-extern DWORD g_mirandaVersion; \ No newline at end of file
+extern DWORD g_mirandaVersion;