summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/metacontacts/meta_main.cpp1
-rw-r--r--src/modules/metacontacts/meta_menu.cpp6
-rw-r--r--src/modules/metacontacts/meta_services.cpp129
-rw-r--r--src/modules/metacontacts/meta_utils.cpp90
4 files changed, 103 insertions, 123 deletions
diff --git a/src/modules/metacontacts/meta_main.cpp b/src/modules/metacontacts/meta_main.cpp
index ac7a888fb5..446bc515f8 100644
--- a/src/modules/metacontacts/meta_main.cpp
+++ b/src/modules/metacontacts/meta_main.cpp
@@ -62,7 +62,6 @@ int LoadMetacontacts(void)
db_set_resident(META_PROTO, "Status");
db_set_resident(META_PROTO, "IdleTS");
- db_set_resident(META_PROTO, "Handle");
db_set_resident(META_PROTO, "WindowOpen");
//set all contacts to 'offline', and initialize subcontact counter for db consistency check
diff --git a/src/modules/metacontacts/meta_menu.cpp b/src/modules/metacontacts/meta_menu.cpp
index a341c8421b..acdb6d3dd7 100644
--- a/src/modules/metacontacts/meta_menu.cpp
+++ b/src/modules/metacontacts/meta_menu.cpp
@@ -129,9 +129,6 @@ void Meta_RemoveContactNumber(DBCachedContact *cc, int number)
// make sure this contact thinks it's part of this metacontact
if (hContact == cc->contactID) {
- // remove link to meta contact
- db_unset(hContact, META_PROTO, "Handle");
-
// stop ignoring, if we were
if (options.suppress_status)
CallService(MS_IGNORE_UNIGNORE, hContact, IGNOREEVENT_USERONLINE);
@@ -151,9 +148,6 @@ void Meta_RemoveContactNumber(DBCachedContact *cc, int number)
strcpy(buffer, "Status"); strcat(buffer, idStr);
db_unset(cc->contactID, META_PROTO, buffer);
- strcpy(buffer, "Handle"); strcat(buffer, idStr);
- db_unset(cc->contactID, META_PROTO, buffer);
-
strcpy(buffer, "StatusString"); strcat(buffer, idStr);
db_unset(cc->contactID, META_PROTO, buffer);
diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp
index 447002e33e..8bad53d5df 100644
--- a/src/modules/metacontacts/meta_services.cpp
+++ b/src/modules/metacontacts/meta_services.cpp
@@ -201,47 +201,38 @@ static DWORD CALLBACK sttFakeAckFail( LPVOID param )
* @return 0 on success, 1 otherwise.
*/
-INT_PTR MetaFilter_SendMessage(WPARAM wParam,LPARAM lParam)
+INT_PTR MetaFilter_SendMessage(WPARAM wParam, LPARAM lParam)
{
CCSDATA *ccs = (CCSDATA*)lParam;
- MCONTACT hMeta;
- if ((hMeta = (MCONTACT)db_get_dw(ccs->hContact, META_PROTO, "Handle", 0)) == 0)
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // Can't find the MetaID of the metacontact linked to
-
- // if subcontact sending, add db event to keep metacontact history correct
- if (options.metahistory && !(ccs->wParam & PREF_METANODB)) {
-
- // reject "file As Message" messages
- if (strlen((char *)ccs->lParam) > 5 && strncmp((char *)ccs->lParam, "<%fAM", 5) == 0)
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // continue processing
-
- // reject "data As Message" messages
- if (strlen((char *)ccs->lParam) > 5 && strncmp((char *)ccs->lParam, "<%dAM", 5) == 0)
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // continue processing
-
- // reject "OTR" messages
- if (strlen((char *)ccs->lParam) > 5 && strncmp((char *)ccs->lParam, "?OTR", 4) == 0)
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // continue processing
-
- DBEVENTINFO dbei = { sizeof(dbei) };
- dbei.szModule = META_PROTO;
- dbei.flags = DBEF_SENT;
- dbei.timestamp = time(NULL);
- dbei.eventType = EVENTTYPE_MESSAGE;
- if (ccs->wParam & PREF_RTL) dbei.flags |= DBEF_RTL;
- if (ccs->wParam & PREF_UTF) dbei.flags |= DBEF_UTF;
- dbei.cbBlob = (DWORD)strlen((char *)ccs->lParam) + 1;
- if ( ccs->wParam & PREF_UNICODE )
- dbei.cbBlob *= ( sizeof( wchar_t )+1 );
- dbei.pBlob = (PBYTE)ccs->lParam;
- db_event_add(hMeta, &dbei);
+ DBCachedContact *cc = currDb->m_cache->GetCachedContact(ccs->hContact);
+ if (cc != NULL) {
+ // if subcontact sending, add db event to keep metacontact history correct
+ if (IsSub(cc) && options.metahistory && !(ccs->wParam & PREF_METANODB)) {
+ // reject "file As Message" messages
+ if (strlen((char*)ccs->lParam) > 5)
+ if (!strncmp((char *)ccs->lParam, "<%fAM", 5) || !strncmp((char *)ccs->lParam, "<%dAM", 5) || !strncmp((char *)ccs->lParam, "?OTR", 4) == 0)
+ return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // continue processing
+
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.szModule = META_PROTO;
+ dbei.flags = DBEF_SENT;
+ dbei.timestamp = time(NULL);
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ if (ccs->wParam & PREF_RTL) dbei.flags |= DBEF_RTL;
+ if (ccs->wParam & PREF_UTF) dbei.flags |= DBEF_UTF;
+ dbei.cbBlob = (DWORD)strlen((char *)ccs->lParam) + 1;
+ if (ccs->wParam & PREF_UNICODE)
+ dbei.cbBlob *= (sizeof(wchar_t)+1);
+ dbei.pBlob = (PBYTE)ccs->lParam;
+ db_event_add(cc->parentID, &dbei);
+ }
}
return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
-INT_PTR Meta_SendNudge(WPARAM wParam,LPARAM lParam)
+INT_PTR Meta_SendNudge(WPARAM wParam, LPARAM lParam)
{
DBCachedContact *cc = CheckMeta(wParam);
if (cc == NULL)
@@ -343,37 +334,34 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam)
{
DBEVENTINFO dbei;
CCSDATA *ccs = (CCSDATA*)lParam;
- PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam;
- MCONTACT hMeta;
+ PROTORECVEVENT *pre = (PROTORECVEVENT *)ccs->lParam;
- // Can't find the MetaID of the metacontact linked to this contact, let through the protocol chain
- if ((hMeta = db_get_dw(ccs->hContact, META_PROTO, "Handle", 0)) == 0)
+ DBCachedContact *cc = currDb->m_cache->GetCachedContact(ccs->hContact);
+ if (cc == NULL || !IsSub(cc))
return CallService(MS_PROTO_CHAINRECV, wParam, (LPARAM)ccs);
if (options.set_default_on_recv) {
- db_set_dw(hMeta, META_PROTO, "Default", ccs->hContact);
- NotifyEventHooks(hEventDefaultChanged, (WPARAM)hMeta, (LPARAM)ccs->hContact); // nick set in event handler
+ db_set_dw(cc->parentID, META_PROTO, "Default", ccs->hContact);
+ NotifyEventHooks(hEventDefaultChanged, cc->parentID, ccs->hContact); // nick set in event handler
}
// if meta disabled (now message api) or window open (message api), or using subcontact windows,
// let through but add db event for metacontact history
- if ( !Meta_IsEnabled() || db_get_b(ccs->hContact, META_PROTO, "WindowOpen", 0) == 1 || options.subcontact_windows) {
-
+ if (!Meta_IsEnabled() || db_get_b(ccs->hContact, META_PROTO, "WindowOpen", 0) == 1 || options.subcontact_windows) {
// add a clist event, so that e.g. there is an icon flashing
// (only add it when message api available, 'cause then we can remove the event when the message window is opened)
if (db_get_b(ccs->hContact, META_PROTO, "WindowOpen", 0) == 0 &&
- db_get_b(hMeta, META_PROTO, "WindowOpen", 0) == 0 &&
- options.flash_meta_message_icon)
- {
+ db_get_b(cc->parentID, META_PROTO, "WindowOpen", 0) == 0 &&
+ options.flash_meta_message_icon) {
TCHAR toolTip[256];
CLISTEVENT cle = { sizeof(cle) };
- cle.hContact = hMeta;
+ cle.hContact = cc->parentID;
cle.flags = CLEF_TCHAR;
cle.hDbEvent = (HANDLE)ccs->hContact; // use subcontact handle as key - then we can remove all events if the subcontact window is opened
cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
cle.pszService = "MetaContacts/CListMessageEvent";
- mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), cli.pfnGetContactDisplayName(hMeta, 0));
+ mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), cli.pfnGetContactDisplayName(cc->parentID, 0));
cle.ptszTooltip = toolTip;
CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
}
@@ -388,8 +376,8 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam)
if (proto) {
MCONTACT hSub = ccs->hContact;
DWORD flags = pre->flags;
- ccs->hContact = hMeta;
- pre->flags |= (db_get_b(hMeta, META_PROTO, "WindowOpen", 0) ? 0 : PREF_CREATEREAD);
+ ccs->hContact = cc->parentID;
+ pre->flags |= (db_get_b(cc->parentID, META_PROTO, "WindowOpen", 0) ? 0 : PREF_CREATEREAD);
if (ProtoServiceExists(proto, PSR_MESSAGE) && !ProtoCallService(proto, PSR_MESSAGE, 0, (LPARAM)ccs))
added = TRUE;
ccs->hContact = hSub;
@@ -397,22 +385,22 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam)
}
}
- if ( !added) {
+ if (!added) {
// otherwise add raw db event
ZeroMemory(&dbei, sizeof(dbei));
dbei.cbSize = sizeof(dbei);
dbei.szModule = META_PROTO;
dbei.timestamp = pre->timestamp;
- dbei.flags = (db_get_b(hMeta, META_PROTO, "WindowOpen", 0) ? 0 : DBEF_READ);
+ dbei.flags = (db_get_b(cc->parentID, META_PROTO, "WindowOpen", 0) ? 0 : DBEF_READ);
if (pre->flags & PREF_RTL) dbei.flags |= DBEF_RTL;
if (pre->flags & PREF_UTF) dbei.flags |= DBEF_UTF;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (DWORD)strlen(pre->szMessage) + 1;
- if ( pre->flags & PREF_UNICODE ) {
- dbei.cbBlob *= ( sizeof( wchar_t )+1 );
- }
- dbei.pBlob = (PBYTE) pre->szMessage;
- db_event_add(hMeta, &dbei);
+ if (pre->flags & PREF_UNICODE)
+ dbei.cbBlob *= (sizeof(wchar_t)+1);
+
+ dbei.pBlob = (PBYTE)pre->szMessage;
+ db_event_add(cc->parentID, &dbei);
}
}
@@ -420,7 +408,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam)
}
MCONTACT hSub = ccs->hContact;
- ccs->hContact = hMeta; // Forward to the associated MetaContact.
+ ccs->hContact = cc->parentID; // Forward to the associated MetaContact.
CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)ccs);
ccs->hContact = hSub;
@@ -437,14 +425,15 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam)
*
* @return 0
*/
+
INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam)
{
CCSDATA *ccs = (CCSDATA*)lParam;
- PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam;
+ PROTORECVEVENT *pre = (PROTORECVEVENT *)ccs->lParam;
// contact is not a meta proto contact - just leave it
char *proto = GetContactProto(ccs->hContact);
- if ( !proto || strcmp(proto, META_PROTO))
+ if (!proto || strcmp(proto, META_PROTO))
return 0;
if (options.use_proto_recv) {
@@ -455,7 +444,7 @@ INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam)
// use the subcontact's protocol to add the db if possible (AIMOSCAR removes HTML here!)
MCONTACT most_online = Meta_GetMostOnline(cc);
if (char *subProto = GetContactProto(most_online))
- if ( ProtoCallService(subProto, PSR_MESSAGE, wParam, lParam) != CALLSERVICE_NOTFOUND)
+ if (ProtoCallService(subProto, PSR_MESSAGE, wParam, lParam) != CALLSERVICE_NOTFOUND)
return 0;
}
@@ -468,14 +457,13 @@ INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam)
if (pre->flags & PREF_UTF) dbei.flags |= DBEF_UTF;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = (DWORD)strlen(pre->szMessage) + 1;
- if ( pre->flags & PREF_UNICODE )
- dbei.cbBlob *= ( sizeof( wchar_t )+1 );
- dbei.pBlob = (PBYTE) pre->szMessage;
+ if (pre->flags & PREF_UNICODE)
+ dbei.cbBlob *= (sizeof(wchar_t)+1);
+ dbei.pBlob = (PBYTE)pre->szMessage;
db_event_add(ccs->hContact, &dbei);
return 0;
}
-
/** Called when an ACK is received.
*
* Retransmit the ACK sent by a simple contact so that it
@@ -486,9 +474,10 @@ INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam)
information about the ACK.
* @return 0 on success, 1 otherwise.
*/
+
int Meta_HandleACK(WPARAM wParam, LPARAM lParam)
{
- ACKDATA *ack = (ACKDATA*) lParam;
+ ACKDATA *ack = (ACKDATA*)lParam;
DBCachedContact *cc = CheckMeta(ack->hContact);
if (cc == NULL)
@@ -513,7 +502,7 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam)
return 0;
}
- if ( !db_get(ack->hContact, "ContactPhoto", "File", &dbv)) {
+ if (!db_get(ack->hContact, "ContactPhoto", "File", &dbv)) {
db_set_ts(cc->contactID, "ContactPhoto", "File", dbv.ptszVal);
db_free(&dbv);
}
@@ -526,7 +515,7 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam)
return ProtoBroadcastAck(META_PROTO, cc->contactID, ack->type, ack->result, (HANDLE)&AI, ack->lParam);
}
-
+
return ProtoBroadcastAck(META_PROTO, cc->contactID, ack->type, ack->result, 0, ack->lParam);
}
}
@@ -535,7 +524,7 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam)
}
// hiding contacts on "CList/UseGroups" setting changed can cause a crash - do it in a seperate thread during idle time
-static DWORD sttHideContacts( BOOL param )
+static DWORD sttHideContacts(BOOL param)
{
Meta_HideMetaContacts((int)param);
return 0;
@@ -546,6 +535,7 @@ static DWORD sttHideContacts( BOOL param )
* @param wParam HANDLE to the contact that has change of its setting.
* @param lParam Reference to a structure that contains the setting that has changed (not used)
*/
+
int Meta_SettingChanged(WPARAM wParam, LPARAM lParam)
{
DBCONTACTWRITESETTING *dcws = (DBCONTACTWRITESETTING *)lParam;
@@ -554,9 +544,8 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam)
// hide metacontacts when groups disabled
if (wParam == 0
- && ((strcmp(dcws->szModule, "CList") == 0 && strcmp(dcws->szSetting, "UseGroups") == 0)
- || (strcmp(dcws->szModule, META_PROTO) == 0 && strcmp(dcws->szSetting, "Enabled") == 0)))
- {
+ && ((strcmp(dcws->szModule, "CList") == 0 && strcmp(dcws->szSetting, "UseGroups") == 0)
+ || (strcmp(dcws->szModule, META_PROTO) == 0 && strcmp(dcws->szSetting, "Enabled") == 0))) {
sttHideContacts(!Meta_IsEnabled());
return 0;
}
diff --git a/src/modules/metacontacts/meta_utils.cpp b/src/modules/metacontacts/meta_utils.cpp
index e9db1348e6..c0d03bde65 100644
--- a/src/modules/metacontacts/meta_utils.cpp
+++ b/src/modules/metacontacts/meta_utils.cpp
@@ -206,13 +206,14 @@ int Meta_SetNick(char *szProto)
*
* @return TRUE on success, FALSE otherwise
*/
+
BOOL Meta_Assign(MCONTACT src, MCONTACT dest, BOOL set_as_default)
{
DWORD num_contacts;
char buffer[512], szId[40];
WORD status;
MCONTACT most_online;
-
+
DBCachedContact *ccDest = CheckMeta(dest);
if (ccDest == NULL)
return FALSE;
@@ -231,13 +232,13 @@ BOOL Meta_Assign(MCONTACT src, MCONTACT dest, BOOL set_as_default)
// Get the login of the subcontact
char *field = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
DBVARIANT dbv;
- if ( db_get(src,szProto, field, &dbv)) {
+ if (db_get(src, szProto, field, &dbv)) {
MessageBox(0, TranslateT("Could not get unique ID of contact"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
// Check that is is 'on the list'
- if ( db_get_b(src, "CList", "NotOnList", 0) == 1) {
+ if (db_get_b(src, "CList", "NotOnList", 0) == 1) {
MessageBox(0, TranslateT("Contact is 'Not on List' - please add the contact to your contact list before assigning."), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
db_free(&dbv);
return FALSE;
@@ -252,9 +253,9 @@ BOOL Meta_Assign(MCONTACT src, MCONTACT dest, BOOL set_as_default)
// write the contact's protocol
strcpy(buffer, "Protocol");
- strcat(buffer, _itoa(num_contacts-1, szId, 10));
+ strcat(buffer, _itoa(num_contacts - 1, szId, 10));
- if ( db_set_s(dest, META_PROTO, buffer, szProto)) {
+ if (db_set_s(dest, META_PROTO, buffer, szProto)) {
MessageBox(0, TranslateT("Could not write contact protocol to MetaContact"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
db_free(&dbv);
return FALSE;
@@ -264,7 +265,7 @@ BOOL Meta_Assign(MCONTACT src, MCONTACT dest, BOOL set_as_default)
strcpy(buffer, "Login");
strcat(buffer, szId);
- if ( db_set(dest, META_PROTO, buffer, &dbv)) {
+ if (db_set(dest, META_PROTO, buffer, &dbv)) {
MessageBox(0, TranslateT("Could not write unique ID of contact to MetaContact"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING);
db_free(&dbv);
return FALSE;
@@ -273,7 +274,7 @@ BOOL Meta_Assign(MCONTACT src, MCONTACT dest, BOOL set_as_default)
db_free(&dbv);
// If we can get the nickname of the subcontact...
- if ( !db_get(src, szProto, "Nick", &dbv)) {
+ if (!db_get(src, szProto, "Nick", &dbv)) {
// write the nickname
strcpy(buffer, "Nick");
strcat(buffer, szId);
@@ -291,7 +292,7 @@ BOOL Meta_Assign(MCONTACT src, MCONTACT dest, BOOL set_as_default)
db_set_ts(dest, META_PROTO, buffer, cli.pfnGetContactDisplayName(src, 0));
// Get the status
- if ( !szProto)
+ if (!szProto)
status = ID_STATUS_OFFLINE;
else
status = db_get_w(src, szProto, "Status", ID_STATUS_OFFLINE);
@@ -316,9 +317,6 @@ BOOL Meta_Assign(MCONTACT src, MCONTACT dest, BOOL set_as_default)
// Write the link in the contact
db_set_dw(src, META_PROTO, "ParentMeta", dest);
- // Write the handle in the contact
- db_set_dw(src, META_PROTO, "Handle", (DWORD)dest);
-
// update count of contacts
db_set_dw(dest, META_PROTO, "NumContacts", num_contacts);
@@ -343,8 +341,8 @@ BOOL Meta_Assign(MCONTACT src, MCONTACT dest, BOOL set_as_default)
AI.format = PA_FORMAT_UNKNOWN;
_tcscpy(AI.filename, _T("X"));
- if ( CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS)
- db_set_ts(dest, "ContactPhoto", "File",AI.filename);
+ if (CallProtoService(META_PROTO, PS_GETAVATARINFOT, 0, (LPARAM)&AI) == GAIR_SUCCESS)
+ db_set_ts(dest, "ContactPhoto", "File", AI.filename);
}
// !!!!!!!!!!!!!!!!!!!!!!!!!
@@ -365,6 +363,7 @@ BOOL Meta_Assign(MCONTACT src, MCONTACT dest, BOOL set_as_default)
* Convenience method - get most online contact supporting messaging
*
*/
+
MCONTACT Meta_GetMostOnline(DBCachedContact *cc)
{
return Meta_GetMostOnlineSupporting(cc, PFLAGNUM_1, PF1_IM);
@@ -388,8 +387,7 @@ MCONTACT Meta_GetMostOnlineSupporting(DBCachedContact *cc, int pflagnum, unsigne
int i, default_contact_number, num_contacts;
// you can't get more online than having the default contact ONLINE - so check that first
- if ((default_contact_number = db_get_dw(cc->contactID, META_PROTO, "Default",INVALID_CONTACT_ID)) == INVALID_CONTACT_ID)
- {
+ if ((default_contact_number = db_get_dw(cc->contactID, META_PROTO, "Default", INVALID_CONTACT_ID)) == INVALID_CONTACT_ID) {
// This is a simple contact - return NULL to signify error.
// (this should normally not happen, since all meta contacts have a default contact)
return NULL;
@@ -441,7 +439,7 @@ MCONTACT Meta_GetMostOnlineSupporting(DBCachedContact *cc, int pflagnum, unsigne
hContact = Meta_GetContactHandle(cc, i);
szProto = GetContactProto(hContact);
- if ( !szProto || CallProtoService(szProto, PS_GETSTATUS, 0, 0) < ID_STATUS_ONLINE) // szProto offline or connecting
+ if (!szProto || CallProtoService(szProto, PS_GETSTATUS, 0, 0) < ID_STATUS_ONLINE) // szProto offline or connecting
continue;
caps = szProto ? CallProtoService(szProto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0;
@@ -486,14 +484,14 @@ int Meta_GetContactNumber(DBCachedContact *cc, MCONTACT hContact)
if (cc->pSubs[i] == hContact)
return i;
- return -1;
+ return -1;
}
BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2)
{
if (dbv1->type != dbv2->type) return FALSE;
- switch(dbv1->type) {
+ switch (dbv1->type) {
case DBVT_BYTE:
return dbv1->bVal == dbv2->bVal;
case DBVT_WORD:
@@ -513,8 +511,8 @@ BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2)
void copy_settings_array(DBCachedContact *ccMeta, char *module, const char *settings[], int num_settings)
{
int num_contacts = db_get_dw(ccMeta->contactID, META_PROTO, "NumContacts", INVALID_CONTACT_ID),
- default_contact = db_get_dw(ccMeta->contactID, META_PROTO, "Default", INVALID_CONTACT_ID),
- most_online = Meta_GetContactNumber(ccMeta, Meta_GetMostOnline(ccMeta));
+ default_contact = db_get_dw(ccMeta->contactID, META_PROTO, "Default", INVALID_CONTACT_ID),
+ most_online = Meta_GetContactNumber(ccMeta, Meta_GetMostOnline(ccMeta));
BOOL use_default = FALSE;
int source_contact = (use_default ? default_contact : most_online);
@@ -583,29 +581,29 @@ void copy_settings_array(DBCachedContact *ccMeta, char *module, const char *sett
}
}
-const char *ProtoSettings[25] =
- {"BirthDay", "BirthMonth", "BirthYear", "Age", "Cell", "Cellular", "Homepage", "email", "Email", "e-mail",
- "FirstName", "MiddleName", "LastName", "Title", "Timezone", "Gender", "MirVer", "ApparentMode", "IdleTS", "LogonTS", "IP", "RealIP",
- "Auth", "ListeningTo", "Country"};
-const char *UserInfoSettings[71] =
- {"NickName", "FirstName", "MiddleName", "LastName", "Title", "Timezone", "Gender", "DOBd", "DOBm", "DOBy",
- "Mye-mail0", "Mye-mail1", "MyPhone0", "MyPhone1", "MyNotes", "PersonalWWW",
- "HomePhone", "HomeFax", "HomeMobile", "HomeStreet", "HomeCity", "HomeState", "HomeZip", "HomeCountry",
- "WorkPhone", "WorkFax", "WorkMobile", "WorkStreet", "WorkCity", "WorkState", "WorkZip", "WorkCountry", "Company", "Department", "Position",
- "Occupation", "Cellular", "Cell", "Phone", "Notes",
-
- "e-mail", "e-mail0", "e-mail1", "Homepage", "MaritalStatus",
- "CompanyCellular", "CompanyCity", "CompanyState", "CompanyStreet", "CompanyCountry", "Companye-mail",
- "CompanyHomepage", "CompanyDepartment", "CompanyOccupation", "CompanyPosition", "CompanyZip",
-
- "OriginCity", "OriginState", "OriginStreet", "OriginCountry", "OriginZip",
- "City", "State", "Street", "Country", "Zip",
-
- "Language1", "Language2", "Language3", "Partner", "Gender"};
-const char *ContactPhotoSettings[5] =
- {"File","Backup","Format","ImageHash","RFile"};
-const char *MBirthdaySettings[3] =
- { "BirthDay", "BirthMonth", "BirthYear"};
+const char *ProtoSettings[25] =
+{ "BirthDay", "BirthMonth", "BirthYear", "Age", "Cell", "Cellular", "Homepage", "email", "Email", "e-mail",
+"FirstName", "MiddleName", "LastName", "Title", "Timezone", "Gender", "MirVer", "ApparentMode", "IdleTS", "LogonTS", "IP", "RealIP",
+"Auth", "ListeningTo", "Country" };
+const char *UserInfoSettings[71] =
+{ "NickName", "FirstName", "MiddleName", "LastName", "Title", "Timezone", "Gender", "DOBd", "DOBm", "DOBy",
+"Mye-mail0", "Mye-mail1", "MyPhone0", "MyPhone1", "MyNotes", "PersonalWWW",
+"HomePhone", "HomeFax", "HomeMobile", "HomeStreet", "HomeCity", "HomeState", "HomeZip", "HomeCountry",
+"WorkPhone", "WorkFax", "WorkMobile", "WorkStreet", "WorkCity", "WorkState", "WorkZip", "WorkCountry", "Company", "Department", "Position",
+"Occupation", "Cellular", "Cell", "Phone", "Notes",
+
+"e-mail", "e-mail0", "e-mail1", "Homepage", "MaritalStatus",
+"CompanyCellular", "CompanyCity", "CompanyState", "CompanyStreet", "CompanyCountry", "Companye-mail",
+"CompanyHomepage", "CompanyDepartment", "CompanyOccupation", "CompanyPosition", "CompanyZip",
+
+"OriginCity", "OriginState", "OriginStreet", "OriginCountry", "OriginZip",
+"City", "State", "Street", "Country", "Zip",
+
+"Language1", "Language2", "Language3", "Partner", "Gender" };
+const char *ContactPhotoSettings[5] =
+{ "File", "Backup", "Format", "ImageHash", "RFile" };
+const char *MBirthdaySettings[3] =
+{ "BirthDay", "BirthMonth", "BirthYear" };
// special handling for status message
// copy from first subcontact with any of these values that has the same status as the most online contact
@@ -660,7 +658,7 @@ void CopyStatusData(DBCachedContact *ccMeta)
if (!bDoneStatus)
db_unset(ccMeta->contactID, "CList", "StatusMsg");
-
+
if (!bDoneXStatus) {
db_unset(ccMeta->contactID, META_PROTO, "XStatusId");
db_unset(ccMeta->contactID, META_PROTO, "XStatusMsg");
@@ -679,7 +677,7 @@ void Meta_CopyData(DBCachedContact *cc)
copy_settings_array(cc, "mBirthday", UserInfoSettings, 3);
copy_settings_array(cc, "ContactPhoto", ContactPhotoSettings, 5);
- if (options.copy_userinfo)
+ if (options.copy_userinfo)
copy_settings_array(cc, "UserInfo", UserInfoSettings, 71);
}
@@ -792,7 +790,7 @@ int Meta_HideMetaContacts(int hide)
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
if (CheckMeta(hContact) == NULL)
continue;
-
+
if (hide)
db_set_b(hContact, "CList", "Hidden", 1);
else