From 3dc0d9b0b7c30ea2f77d74c4ce5b6ccd67bd525c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 9 Apr 2013 21:40:22 +0000 Subject: - the kernel filters out contacts by proto names much faster than a plugin; - database cycles simplified git-svn-id: http://svn.miranda-ng.org/main/trunk@4404 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tlen/src/jabber_thread.cpp | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'protocols/Tlen/src/jabber_thread.cpp') diff --git a/protocols/Tlen/src/jabber_thread.cpp b/protocols/Tlen/src/jabber_thread.cpp index 896bf29016..0cc09e86c4 100644 --- a/protocols/Tlen/src/jabber_thread.cpp +++ b/protocols/Tlen/src/jabber_thread.cpp @@ -274,18 +274,6 @@ void __cdecl JabberServerThread(ThreadData *info) return; } - // Determine local IP - /* - socket = CallService(MS_NETLIB_GETSOCKET, (WPARAM) proto, 0); - struct sockaddr_in saddr; - int len; - - len = sizeof(saddr); - getsockname(socket, (struct sockaddr *) &saddr, &len); - jabberLocalIP = saddr.sin_addr.S_un.S_addr; - JabberLog("Local IP = %s", inet_ntoa(saddr.sin_addr)); - */ - // User may change status to OFFLINE while we are connecting above if (info->proto->m_iDesiredStatus != ID_STATUS_OFFLINE) { @@ -357,19 +345,15 @@ void __cdecl JabberServerThread(ThreadData *info) Menu_ModifyItem(info->proto->hMenuChats, &mi); // Set status to offline + char *szProto = info->proto->m_szModuleName; oldStatus = info->proto->m_iStatus; info->proto->m_iStatus = ID_STATUS_OFFLINE; - ProtoBroadcastAck(info->proto->m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, info->proto->m_iStatus); + ProtoBroadcastAck(szProto, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, info->proto->m_iStatus); // Set all contacts to offline - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { - str = GetContactProto(hContact); - if (str != NULL && !strcmp(str, info->proto->m_szModuleName)) { - if (db_get_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) { - db_set_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE); - } - } - } + for (HANDLE hContact = db_find_first(szProto); hContact; hContact = db_find_next(hContact, szProto)) + if (db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) + db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); JabberListWipeSpecial(info->proto); } -- cgit v1.2.3