On Tuesday 26 June 2007 09:14, NOne None wrote:
> Hello Dear,
> I have writing antispam plugin for Kopete and have some questions)
> 1. When receive a new message, how to understand, is user anonymous or
> already in my contact list?
there is no way to detect this particular case. you can detect if a person is
not on your contact list though. check the value of
metacontact()->groups().first() and make sure it's not equal to
Kopete::Group::Temporary (or similar, this is not exact code)
> 2. How to drop message if i detect a spam. i
> only have the Kopete::Message &msg reference.
> ----- Begin
> spamfilterplugin.cpp --------------------------------
> void SpamFilterPlugin::slotAboutToSend( Kopete::Message &msg )
> {
> if ( ( msg.direction() == Kopete::Message::Inbound ) )
> {
> bool Spam = false;
> // Check spam
>
> //
> if ( Spam )
> {
> const Contact *from = msg.from();
> Account *ac = from->account();
> ac->block(ac->accountId());
> // deleting message
> //delete msg;
> }
>
> }
>
> }
> ------------ EOF------------------------------
I don't think you'll want to use slotAboutToSend for that, but I wouldn't know
how to go about dropping the message
--
Matt
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel