int CAimProto::OnGroupChange(WPARAM hContact, LPARAM lParam) { if (m_state != 1 || !getByte(AIM_KEY_MG, 1)) return 0; CLISTGROUPCHANGE *grpchg = (CLISTGROUPCHANGE*)lParam; if (hContact == NULL) { if (grpchg->pszNewName == NULL && grpchg->pszOldName != NULL) { T2Utf szOldName(grpchg->pszOldName); unsigned short group_id = m_group_list.find_id(szOldName); if (group_id) { aim_delete_contact(m_hServerConn, m_seqno, szOldName, 0, group_id, 1, false); m_group_list.remove_by_id(group_id); update_server_group("", 0); } } else if (grpchg->pszNewName != NULL && grpchg->pszOldName != NULL) { unsigned short group_id = m_group_list.find_id(T2Utf(grpchg->pszOldName)); if (group_id) update_server_group(T2Utf(grpchg->pszNewName), group_id); } } else { if (is_my_contact(hContact) && getBuddyId(hContact, 1) && !db_get_b(hContact, MOD_KEY_CL, AIM_KEY_NL, 0)) { if (grpchg->pszNewName) add_contact_to_group(hContact, T2Utf(grpchg->pszNewName)); else add_contact_to_group(hContact, AIM_DEFAULT_GROUP); } } return 0; }
int CAimProto::OnGroupChange(WPARAM wParam,LPARAM lParam) { if (state != 1 || !getByte(AIM_KEY_MG, 1)) return 0; const HANDLE hContact = (HANDLE)wParam; const CLISTGROUPCHANGE* grpchg = (CLISTGROUPCHANGE*)lParam; if (hContact == NULL) { if (grpchg->pszNewName == NULL && grpchg->pszOldName != NULL) { char* szOldName = mir_utf8encodeT(grpchg->pszOldName); unsigned short group_id = group_list.find_id(szOldName); if (group_id) { aim_delete_contact(hServerConn, seqno, szOldName, 0, group_id, 1, false); group_list.remove_by_id(group_id); update_server_group("", 0); } mir_free(szOldName); } else if (grpchg->pszNewName != NULL && grpchg->pszOldName != NULL) { char* szOldName = mir_utf8encodeT(grpchg->pszOldName); unsigned short group_id = group_list.find_id(szOldName); if (group_id) { char* szNewName = mir_utf8encodeT(grpchg->pszNewName); update_server_group(szNewName, group_id); mir_free(szNewName); } mir_free(szOldName); } } else { if (is_my_contact(hContact) && getBuddyId(hContact, 1) && !DBGetContactSettingByte(hContact, MOD_KEY_CL, AIM_KEY_NL, 0)) { if (grpchg->pszNewName) { char* szNewName = mir_utf8encodeT(grpchg->pszNewName); add_contact_to_group(hContact, szNewName); mir_free(szNewName); } else add_contact_to_group(hContact, AIM_DEFAULT_GROUP); } } return 0; }
int CAimProto::OnWindowEvent(WPARAM, LPARAM lParam) { MessageWindowEventData* msgEvData = (MessageWindowEventData*)lParam; if (msgEvData->uType == MSG_WINDOW_EVT_CLOSE) { if (m_state != 1 || !is_my_contact(msgEvData->hContact)) return 0; if (getWord(msgEvData->hContact, AIM_KEY_ST, ID_STATUS_OFFLINE) == ID_STATUS_ONTHEPHONE) return 0; DBVARIANT dbv; if (!getBool(msgEvData->hContact, AIM_KEY_BLS, false) && !getString(msgEvData->hContact, AIM_KEY_SN, &dbv)) { if (_stricmp(dbv.pszVal, SYSTEM_BUDDY)) aim_typing_notification(m_hServerConn, m_seqno, dbv.pszVal, 0x000f); db_free(&dbv); } } return 0; }