Logo Search packages:      
Sourcecode: kmess version File versions

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 293 of file msnobject.cpp.

References getAttribute().

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

  // 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;

  const 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.toUtf8() );

  // The data hash is not available: use the full object hash
  return ( sha1c_ != getAttribute( "SHA1C", newObj ).toUtf8() );

Generated by  Doxygen 1.6.0   Back to index