Logo Search packages:      
Sourcecode: kmess version File versions  Download package

bool MsnObject::hasChanged ( const QString &  newObj  )  const

Compares this MSN object to the string version passed in. This takes a shortcut by comparing the SHA1C hash, since it hashes the data hash and the full MSN object. How convenient.

newObj The MSN object returned from the server.

Definition at line 291 of file msnobject.cpp.

References getAttribute().

Referenced by PictureTransferP2P::contactStarted1_gotDisplayPictureRequest(), and PictureTransferP2P::contactStarted1_gotEmoticonRequest().

  // TODO: The QString comparing with != should be overridden to match on QCStrings or char*'s

  // If no hash is present we can't check it, assume it's changed.
  // Will probably just waste a bit of bandwidth.
  if( sha1c_.isEmpty() && sha1d_.isEmpty() )
    return true;

  QString objSha1d = getAttribute( "SHA1D", newObj );

  // The data hash is more important than the full object hash, if it's present, use it
  if( ! sha1d_.isEmpty() && ! objSha1d.isEmpty() )
    // If false the data is the same, the object hasn't changed
    return ( sha1d_ != objSha1d.utf8() );

  // The data hash is not available: use the full object hash

  return ( sha1c_ != getAttribute( "SHA1C", newObj ).utf8() );

Generated by  Doxygen 1.6.0   Back to index