diff options
Diffstat (limited to 'protocols/JabberG/jabber_thread.cpp')
-rw-r--r-- | protocols/JabberG/jabber_thread.cpp | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/protocols/JabberG/jabber_thread.cpp b/protocols/JabberG/jabber_thread.cpp index 4bd558b048..191516a9d7 100644 --- a/protocols/JabberG/jabber_thread.cpp +++ b/protocols/JabberG/jabber_thread.cpp @@ -19,10 +19,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-Revision : $Revision: 14176 $
-Last change on : $Date: 2012-03-11 16:05:02 +0200 (Вс, 11 мар 2012) $
-Last change by : $Author: borkra $
-
*/
#include "jabber.h"
@@ -1118,7 +1114,7 @@ HANDLE CJabberProto::CreateTemporaryContact( const TCHAR *szJid, JABBER_LIST_ITE void CJabberProto::OnProcessMessage( HXML node, ThreadData* info )
{
HXML subjectNode, xNode, inviteNode, idNode, n;
- LPCTSTR from, type, idStr, fromResource;
+ LPCTSTR from, type, idStr;
HANDLE hContact;
if ( !xmlGetName( node ) || _tcscmp( xmlGetName( node ), _T("message")))
@@ -1215,8 +1211,11 @@ void CJabberProto::OnProcessMessage( HXML node, ThreadData* info ) JCallService( MS_PROTO_CONTACTISTYPING, ( WPARAM )hContact, PROTOTYPE_CONTACTTYPING_OFF );
// chatstates inactive event
- if ( hContact && xmlGetChildByTag( node, "inactive", "xmlns", _T( JABBER_FEAT_CHATSTATES )))
+ if ( hContact && xmlGetChildByTag( node, "inactive", "xmlns", _T( JABBER_FEAT_CHATSTATES ))) {
JCallService( MS_PROTO_CONTACTISTYPING, ( WPARAM )hContact, PROTOTYPE_CONTACTTYPING_OFF );
+ if ( resourceStatus )
+ resourceStatus->uMessageSessionActive = 0;
+ }
// message receipts delivery notification
if ( n = xmlGetChildByTag( node, "received", "xmlns", _T( JABBER_FEAT_MESSAGE_RECEIPTS ))) {
@@ -1256,17 +1255,20 @@ void CJabberProto::OnProcessMessage( HXML node, ThreadData* info ) }
// chatstates gone event
- if ( hContact && xmlGetChildByTag( node, "gone", "xmlns", _T( JABBER_FEAT_CHATSTATES )) && m_options.LogChatstates ) {
- DBEVENTINFO dbei;
- BYTE bEventType = JABBER_DB_EVENT_CHATSTATES_GONE; // gone event
- dbei.cbSize = sizeof(dbei);
- dbei.pBlob = &bEventType;
- dbei.cbBlob = 1;
- dbei.eventType = JABBER_DB_EVENT_TYPE_CHATSTATES;
- dbei.flags = DBEF_READ;
- dbei.timestamp = time(NULL);
- dbei.szModule = m_szModuleName;
- CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
+ if ( hContact && xmlGetChildByTag( node, "gone", "xmlns", _T( JABBER_FEAT_CHATSTATES ))) {
+ if ( resourceStatus ) resourceStatus->uMessageSessionActive = 0;
+ if ( m_options.LogChatstates ) {
+ DBEVENTINFO dbei;
+ BYTE bEventType = JABBER_DB_EVENT_CHATSTATES_GONE; // gone event
+ dbei.cbSize = sizeof(dbei);
+ dbei.pBlob = &bEventType;
+ dbei.cbBlob = 1;
+ dbei.eventType = JABBER_DB_EVENT_TYPE_CHATSTATES;
+ dbei.flags = DBEF_READ;
+ dbei.timestamp = time(NULL);
+ dbei.szModule = m_szModuleName;
+ CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei);
+ }
}
if (( n = xmlGetChildByTag( node, "confirm", "xmlns", _T( JABBER_FEAT_HTTP_AUTH ))) && m_options.AcceptHttpAuth ) {
@@ -1472,25 +1474,26 @@ void CJabberProto::OnProcessMessage( HXML node, ThreadData* info ) if (( szMessage = JabberUnixToDosT( szMessage )) == NULL )
szMessage = mir_tstrdup( _T(""));
- char* buf = mir_utf8encodeW( szMessage );
+ char* buf = mir_utf8encodeW(szMessage);
if ( item != NULL ) {
- if ( resourceStatus ) resourceStatus->bMessageSessionActive = TRUE;
if ( hContact != NULL )
JCallService( MS_PROTO_CONTACTISTYPING, ( WPARAM ) hContact, PROTOTYPE_CONTACTTYPING_OFF );
- // no we will monitor last resource in all modes
- if ( /*item->resourceMode==RSMODE_LASTSEEN &&*/ ( fromResource = _tcschr( from, '/' ))!=NULL ) {
- fromResource++;
- if ( *fromResource != '\0' ) {
- for ( int i=0; i<item->resourceCount; i++ ) {
- if ( !lstrcmp( item->resource[i].resourceName, fromResource )) {
- int nLastSeenResource = item->lastSeenResource;
- item->lastSeenResource = i;
- if ((item->resourceMode==RSMODE_LASTSEEN) && (i != nLastSeenResource))
- UpdateMirVer(item);
- break;
- } } } } }
+ if (item->resourceMode != RSMODE_MANUAL && resourceStatus != item->lastSeenResource) {
+ item->lastSeenResource = resourceStatus;
+ UpdateMirVer(item);
+ }
+ else item->lastSeenResource = resourceStatus;
+
+ if ( resourceStatus && resourceStatus->uMessageSessionActive == 0 ) {
+ for ( int i=0; i<item->resourceCount; i++ )
+ if ( &item->resource[i] != resourceStatus )
+ item->resource[i].uMessageSessionActive = 0;
+ }
+ if ( resourceStatus )
+ resourceStatus->uMessageSessionActive = time(NULL);
+ }
// Create a temporary contact
if ( hContact == NULL )
@@ -1521,7 +1524,8 @@ void CJabberProto::OnProcessMessage( HXML node, ThreadData* info ) mir_free(( void* )szMessage );
mir_free( buf );
-} }
+ }
+}
// XEP-0115: Entity Capabilities
void CJabberProto::OnProcessPresenceCapabilites( HXML node )
|