summaryrefslogtreecommitdiff
path: root/protocols/AimOscar/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/AimOscar/src')
-rw-r--r--protocols/AimOscar/src/services.cpp3
-rw-r--r--protocols/AimOscar/src/theme.cpp18
-rw-r--r--protocols/AimOscar/src/ui.cpp2
-rw-r--r--protocols/AimOscar/src/utility.cpp76
4 files changed, 44 insertions, 55 deletions
diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp
index 52c9bf37ce..bfc0ca83ed 100644
--- a/protocols/AimOscar/src/services.cpp
+++ b/protocols/AimOscar/src/services.cpp
@@ -236,8 +236,7 @@ int CAimProto::OnGroupChange(WPARAM wParam,LPARAM lParam)
}
else
{
- if (is_my_contact(hContact) && getBuddyId(hContact, 1) &&
- !db_get_b(hContact, MOD_KEY_CL, AIM_KEY_NL, 0))
+ if (is_my_contact(hContact) && getBuddyId(hContact, 1) && !db_get_b(hContact, MOD_KEY_CL, AIM_KEY_NL, 0))
{
if (grpchg->pszNewName)
{
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp
index 3dc5dce55f..5f595d2cc6 100644
--- a/protocols/AimOscar/src/theme.cpp
+++ b/protocols/AimOscar/src/theme.cpp
@@ -144,30 +144,28 @@ void set_contact_icon(CAimProto* ppro, HANDLE hContact)
void remove_AT_icons(CAimProto* ppro)
{
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- if (ppro->is_my_contact(hContact) && !ppro->getByte(hContact, "ChatRoom", 0))
+ for (HANDLE hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName))
+ if (!ppro->getByte(hContact, "ChatRoom", 0))
ExtraIcon_Clear(hExtraAT, hContact);
}
void remove_ES_icons(CAimProto* ppro)
{
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- if (ppro->is_my_contact(hContact) && !ppro->getByte(hContact, "ChatRoom", 0))
+ for (HANDLE hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName))
+ if (!ppro->getByte(hContact, "ChatRoom", 0))
ExtraIcon_Clear(hExtraES, hContact);
}
void add_AT_icons(CAimProto* ppro)
{
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- if (ppro->is_my_contact(hContact))
- set_AT_icon(ppro, hContact);
+ for (HANDLE hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName))
+ set_AT_icon(ppro, hContact);
}
void add_ES_icons(CAimProto* ppro)
{
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- if (ppro->is_my_contact(hContact))
- set_ES_icon(ppro, hContact);
+ for (HANDLE hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName))
+ set_ES_icon(ppro, hContact);
}
void InitExtraIcons(void)
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp
index 25e04fd38e..f98f643db2 100644
--- a/protocols/AimOscar/src/ui.cpp
+++ b/protocols/AimOscar/src/ui.cpp
@@ -1403,7 +1403,7 @@ static void clist_chat_invite_send(HANDLE hItem, HWND hwndList, chat_list_item*
static void clist_validate_contact(HANDLE hItem, HWND hwndList, CAimProto* ppro)
{
if (!ppro->is_my_contact(hItem) || ppro->getByte(hItem, "ChatRoom", 0) ||
- ppro->getWord(hItem, AIM_KEY_ST, ID_STATUS_OFFLINE) == ID_STATUS_ONTHEPHONE)
+ ppro->getWord(hItem, AIM_KEY_ST, ID_STATUS_OFFLINE) == ID_STATUS_ONTHEPHONE)
SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0);
}
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp
index 4fbc7a03c5..e2ba0bc4f1 100644
--- a/protocols/AimOscar/src/utility.cpp
+++ b/protocols/AimOscar/src/utility.cpp
@@ -168,14 +168,13 @@ bool CAimProto::is_my_contact(HANDLE hContact)
HANDLE CAimProto::find_chat_contact(const char* room)
{
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- if (is_my_contact(hContact)) {
- DBVARIANT dbv;
- if (!getString(hContact, "ChatRoomID", &dbv)) {
- bool found = !strcmp(room, dbv.pszVal);
- db_free(&dbv);
- if (found) return hContact;
- }
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ DBVARIANT dbv;
+ if (!getString(hContact, "ChatRoomID", &dbv)) {
+ bool found = !strcmp(room, dbv.pszVal);
+ db_free(&dbv);
+ if (found)
+ return hContact;
}
}
return NULL;
@@ -185,15 +184,13 @@ HANDLE CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool tempora
{
mir_ptr<char> norm_sn( normalize_name(sn));
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- if (is_my_contact(hContact)) {
- DBVARIANT dbv;
- if (!getString(hContact, AIM_KEY_SN, &dbv)) {
- bool found = !strcmp(norm_sn, dbv.pszVal);
- db_free(&dbv);
- if (found)
- return hContact;
- }
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ DBVARIANT dbv;
+ if (!getString(hContact, AIM_KEY_SN, &dbv)) {
+ bool found = !strcmp(norm_sn, dbv.pszVal);
+ db_free(&dbv);
+ if (found)
+ return hContact;
}
}
@@ -321,9 +318,8 @@ void CAimProto::offline_contact(HANDLE hContact, bool remove_settings)
void CAimProto::offline_contacts(void)
{
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- if (is_my_contact(hContact))
- offline_contact(hContact,true);
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
+ offline_contact(hContact,true);
allow_list.destroy();
block_list.destroy();
@@ -387,14 +383,12 @@ unsigned short CAimProto::search_for_free_item_id(HANDLE hbuddy)//returns a free
retry:
id = get_random();
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- if (is_my_contact(hContact)) {
- for(int i=1; ;++i) {
- unsigned short item_id = getBuddyId(hContact, i);
- if (item_id == 0) break;
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for(int i=1; ;++i) {
+ unsigned short item_id = getBuddyId(hContact, i);
+ if (item_id == 0) break;
- if (item_id == id) goto retry; //found one no need to look through anymore
- }
+ if (item_id == id) goto retry; //found one no need to look through anymore
}
}
@@ -408,19 +402,17 @@ unsigned short* CAimProto::get_members_of_group(unsigned short group_id, unsigne
unsigned short* list = NULL;
size = 0;
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- if (is_my_contact(hContact)) {
- for(int i=1; ;++i) {
- unsigned short user_group_id = getGroupId(hContact, i);
- if (user_group_id == 0)
- break;
-
- if (group_id == user_group_id) {
- unsigned short buddy_id = getBuddyId(hContact, i);
- if (buddy_id) {
- list = (unsigned short*)mir_realloc(list, ++size*sizeof(list[0]));
- list[size-1] = _htons(buddy_id);
- }
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ for(int i=1; ;++i) {
+ unsigned short user_group_id = getGroupId(hContact, i);
+ if (user_group_id == 0)
+ break;
+
+ if (group_id == user_group_id) {
+ unsigned short buddy_id = getBuddyId(hContact, i);
+ if (buddy_id) {
+ list = (unsigned short*)mir_realloc(list, ++size*sizeof(list[0]));
+ list[size-1] = _htons(buddy_id);
}
}
}
@@ -430,9 +422,9 @@ unsigned short* CAimProto::get_members_of_group(unsigned short group_id, unsigne
void CAimProto::upload_nicks(void)
{
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
DBVARIANT dbv;
- if (is_my_contact(hContact) && !db_get_utf(hContact, MOD_KEY_CL, "MyHandle", &dbv)) {
+ if ( !db_get_utf(hContact, MOD_KEY_CL, "MyHandle", &dbv)) {
set_local_nick(hContact, dbv.pszVal, NULL);
db_free(&dbv);
}