Enable/disable logging on a contact-by-contact basis?

Moos Heintzen iwasroot at gmail.com
Thu Jan 3 00:22:41 EST 2008


Richard Laager wrote:
> On Tue, 2008-01-01 at 09:54 +1100, Evgeny Potashnik wrote:
>   
>> I'm a new user of Pidgin and I've got a newbie question. I would like
>> to enable logging by default, but some people object to being logged,
>> so I want to disable logging for a few specific contacts. I know that
>> I can uncheck Options, Enable Logging in a chat window, but Pidgin
>> "forgets" that the next time I open a chat with the same contact. Is
>> there any way to store this setting permanently? 
>>     
>
> I wouldn't be opposed to a patch that saves this setting on the contact
> level.
How/where is it going to be saved? I found the "gboolean logging;" 
member in the PurpleConversation structure in libpurple/conversation.h
It has purple_conversation_set_logging() and 
purple_conversation_is_logging() functions.

the menu_logging_cb() function in pidgin/gtkconv.c is used to turn the 
logging on or off for the current session. (apparently when the user 
clicks on the check mark) using the above accessor functions.


As proposed by Sadrul Habib, I found that the setting for the sounds 
uses a blist.

        purple_blist_node_set_bool(node, "gtk-mute-sound", 
!gtkconv->make_sound);

I found that the blist is stored in ~/.purple/blist.xml
So all we have to is to use the blist to store the logging status the 
same way the make_sound boolean is stored :)

Then we have to read the variable from the blist when the conversation 
window is initialized.
I believe it's in the private_gtkconv_new() function in 
pidgin/gtkconv.c, as the make_sound option is also initialized there.

> I would really like it to show a message in the window when the
> conversation is opened if the setting differs from the default. In other
> words, something like, "This conversation is [not] being logged."
>   
How can we find out what the default is? I found the setting in 
~/.purple/prefs.xml under logging->log_ims, but I don't know how to 
access it.
> We already have a similar message when logging is supposed to be on but
> fails. Such a message comes up if you use my suggested work-around for
> the lack of this feature: Change the permissions for the specific
> contact's folders to remove write permission. Something like this would
> do it (replace things in caps as appropriate):
> 	chmod -w ~/.purple/logs/PRPL_NAME/ACCOUNT/CONTACT
>   
I found (grepped!) this message in purple/log.c. It checks if there was 
an error in opening the file.
if (data->file == NULL)
{
...
     purple_conversation_write(log->conv, NULL, _("Logging of this 
conversation failed."),
                       PURPLE_MESSAGE_ERROR, time(NULL));
...
}

This is in libpurple and not in pidgin...

> This should be really trivial and would be an excellent project for
> someone new to work on. For that reason, I've CC'ed Moos Heintzen, who
> was asking about this the other day. Still, feel free to work on this
> yourself if you're a programmer. I can provide guidance.
>   
Thank you for considering me!

Moos




More information about the Devel mailing list