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

const QString MsnObject::objectString (  )  const

Generates the string representation of the MsnObject. This is what we use when we actually want to send the object over the wire to a remote client.

Definition at line 249 of file msnobject.cpp.

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

{
  if( ! original_.isEmpty() )
  {
    return original_;
  }

  QCString friendlyBase64;

  if( friendly_.length() == 0 )
  {
    friendlyBase64 = "AA==";  // null-terminator and padding.
  }
  else
  {
    QByteArray friendlyUcs2;
    int size = friendly_.length() * 2;

    // Copy existing UTF16 string to an QByteArray
    friendlyUcs2.duplicate( reinterpret_cast<const char*>(friendly_.ucs2()), size );
    // Add null-padding
    friendlyUcs2.resize( size + 4 );
    friendlyUcs2[size + 0] = '\0';
    friendlyUcs2[size + 1] = '\0';
    friendlyUcs2[size + 2] = '\0';
    friendlyUcs2[size + 3] = '\0';

    // To BASE64 encoding.
    friendlyBase64 = KCodecs::base64Decode(friendlyUcs2);
  }

  // Create msn object string.
  return QString(
                 "<msnobj Creator=\"%1\" Size=\"%2\" Type=\"%3\""
                 " Location=\"%4\" Friendly=\"%5\""
                 " SHA1D=\"%6\" SHA1C=\"%7\"/>"
                )
                .arg(creator_).arg(size_).arg(type_).arg(location_).arg(friendlyBase64)
                .arg(sha1d_).arg(sha1c_);
}


Generated by  Doxygen 1.6.0   Back to index