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

void ChatView::slotIgnoreEmoticon (  )  [private, slot]

Add an emoticon from the chat to the contact's emoticon blacklist.

The user can add a contact's emoticons into a black list: KMess will not display blacklisted emoticons, and keep the shortcut as text. Useful for contacts having annoying emoticons.

Definition at line 748 of file chatview.cpp.

References CurrentAccount::getContactByHandle(), and ChatMessageView::removeCustomEmoticon().

{
  if( ! chatViewClickedUrl_.isValid() || chatViewClickedUrl_.protocol() != "kmess" || chatViewClickedUrl_.host() != "emoticon" )
  {
#ifdef KMESSDEBUG_CHATVIEW
    kDebug() << "Ignoring request for invalid URL: " << chatViewClickedUrl_;
#endif

    return;
  }

/*
 * KMess' internal emoticon URLs are in the form
 * <code>kmess://emoticon/contactHandle/urlEncodedShortcut/urlEncodedPicturePath</code>
 */

  QString path( chatViewClickedUrl_.path().mid( 1 ) );  // remove first /

#ifdef KMESSTEST
  KMESS_ASSERT( ! path.isEmpty() );
#endif

  // Reset the url
  chatViewClickedUrl_.clear();

  QString handle  ( path.section( "/", 0, 0 ) );   // First parameter: contact handle
  QString shortcut( path.section( "/", 1, 1 ) );   // Second parameter: emoticon shortcut

  ContactBase *contact = CurrentAccount::instance()->getContactByHandle( handle );
  if( contact == 0 )
  {
#ifdef KMESSDEBUG_CHATVIEW
    kDebug() << "Contact handle not found: " << handle;
#endif

    return;
  }

  // URL-Decode the encoded strings
  shortcut = KUrl::fromPercentEncoding( shortcut.toUtf8() );

  // Add the emoticon to the contact's blacklist and update the chat
  if( contact->manageEmoticonBlackList( true, shortcut ) )
  {
    chatMessageView_->removeCustomEmoticon( shortcut );
  }
}


Generated by  Doxygen 1.6.0   Back to index