Just starting to use sieve and i wonder if a feature/hook like this is possible:

if a new person is added to the adressbook start to rewrite a -dynamic- sieve (the one thing i hate sive for is that i cant filter dynamicly on my adressbook) rule on the server so mail from all persons in the adressbook gets routed to folder X.

i think sogo needs to export the sieve api for this and also that person-added-to-adressbook hook mentioned on the wiki page.

and sooner or later some mechanism to pass variables into scripts would be needed, like user-preferences for scripts. (i bet the existing preferences can be extended to allow this). also system wide defaults via config file would be nice ;)

On 07/29/2011 11:31 PM, Ludovic Marcotte wrote:
Hello,

It's done - we can now extend SOGo directly in Python. One can easily create a Python class, define methods and create it as an object in Objective-C.

So what does that mean? It'll be possible for us to define "hooks" - methods that SOGo will invoke and people will implement in Python. For example, we could create a hook in SOGoParentFolder (_createPersonalFolder) :

- Name: -personalFolderWasCreated: (SOGoGCSFolder *) theFolder forUser: (SOGoUser *) theUser

- Description: This method will be invoked whenever a personal folder (default Calendar or Address Book) is created. Using this hook, you can for example, automatically subscribe the user when he "first logs in" to some other resources or you can
                create additional resources.

Your Python module would simply look like:

=== SNIP ===
import objc

class Foobar (objc.lookUpClass('NSObject')):
    """Simple SOGo Bundle"""

    def init(self):
        return self

    def personalFolderWasCreated_forUser_(self, folder, user):
        // do your own stuff here
=== SNIP ===

Of course, from Python, you will be able to call Objective-C methods on objects (from SOGo/SOPE/GNUstep, etc.) or any other stuff coming for the gazillion on Python modules out there. Your Python module would simply be in a bundle, together with its resources.

What we need from you? Ideas for hooks.

Regards,

--
users@sogo.nu
https://inverse.ca/sogo/lists

Reply via email to