mlmmj code refactoring, for ease of reuse
Hi,
I wasn't able to find any posts related to this topic, so I am posting to the list for comments.
I would like to create a convenient system for provisioning mlmmj mailinglists across a network. That is, I would like to be able to connect to a daemon on a given host, and tell it to create a list, subscribe a user, unsubscribe a user, etc. This would also make it easier to create user interfaces for manipulating mlmmj.
In order to minimize the work involved, I intend to write the thing in C, and I was hoping to reuse mlmmj code, to do most of the actual work. Unfortunately, lots of mlmmj functionality is hidden away inside various main() methods, making it quite hard to export the functionality for easy access from other code.
Do you have any suggestions for accessing this functionality, short of copying the code verbatim into my own source files?
Thanks.
Signature · 3 lines
Søren O. "Oh, bother" said the Borg, "we've assimilated Pooh".
Quoted 7 lines · Søren Boll Overgaard
I would like to create a convenient system for provisioning mlmmj mailinglists across a network. That is, I would like to be able to connect to a daemon on a given host, and tell it to create a list, subscribe a user, unsubscribe a user, etc. This would also make it easier to create user interfaces for manipulating mlmmj.
In order to minimize the work involved, I intend to write the thing in C,
I think coding in C does usually not minimize the work. Instead of reusing the mlmmj code (and therefore having to keep pace with new versions), I'd rather do it The Unix Way: Write a simple wrapper script/programm (Perl, Python, Ruby, $whatever, even in C that's no big deal) which reads commands from a tcp socket or, even easier, reads from STDIN (so you can use it with inetd), and invokes the corresponding mlmmj binary. The only reason to do this in a single C programm would be performance, but I guess you are not going to create thousands of lists per second.
Quoted 10 lines · Jakob Hirsch
Quoted 7 lines · Søren Boll Overgaard
I would like to create a convenient system for provisioning mlmmj mailinglists across a network. That is, I would like to be able to connect to a daemon on a given host, and tell it to create a list, subscribe a user, unsubscribe a user, etc. This would also make it easier to create user interfaces for manipulating mlmmj.
In order to minimize the work involved, I intend to write the thing in C,
Quoted 8 lines
I think coding in C does usually not minimize the work. Instead of reusing the mlmmj code (and therefore having to keep pace with new versions), I'd rather do it The Unix Way: Write a simple wrapper script/programm (Perl, Python, Ruby, $whatever, even in C that's no big deal) which reads commands from a tcp socket or, even easier, reads from STDIN (so you can use it with inetd), and invokes the corresponding mlmmj binary. The only reason to do this in a single C programm would be performance, but I guess you are not going to create thousands of lists per second.
You are right of course, as using execlp() is excactly how (sub, unsub, etc.) commands are executed inside mlmmj.
Generally though, I think it would be nice if mlmmj exported a more developer friendly C api, with functions like subscribe(), unsubscribe(), create_list(), etc. Perhaps even by means of a shared library?
Anyway, I will look into the approach you are suggesting, probably based on python.
Thanks for the input.
Signature · 3 lines
Søren O. "Oh, bother" said the Borg, "we've assimilated Pooh".
Replying to my own post,
Quoted 7 lines · Søren Boll Overgaard
Generally though, I think it would be nice if mlmmj exported a more developer friendly C api, with functions like
subscribe(),unsubscribe(),create_list(), etc. Perhaps even by means of a shared library?Anyway, I will look into the approach you are suggesting, probably based on python.
I have all but completed writing a server for remotely managing an mlmmj installation. The server is written in python and uses the mlmmj-* binaries for functionality whereever possible.
Additionally, I've written a fairly basic php client.
I would greatly appreciate it if someone would contribue clients written in other languages. In my opinion that would be the best way to thoroughly test the server before I publish the code.
If you are interested, please get in touch with me directly and we can coordinate.
Thanks.
Signature · 3 lines
Søren O. "Oh, bother" said the Borg, "we've assimilated Pooh".
Quoted 5 lines · Søren Boll Overgaard
Quoted 5 lines
Generally though, I think it would be nice if mlmmj exported a more developer friendly C api, with functions like
subscribe(),unsubscribe(),create_list(), etc. Perhaps even by means of a shared library?
Quoted 9 lines
Quoted 2 lines
Anyway, I will look into the approach you are suggesting, probably based on python.
I have all but completed writing a server for remotely managing an mlmmj installation. The server is written in python and uses the mlmmj-* binaries for functionality whereever possible.
Additionally, I've written a fairly basic php client.
I've made the code available at
http://soren.overgaard.org/cgi-bin/index?t=mlmmjadmd if anyone is interested. It appears to be working as intended, though I can't be completely sure, since my test script doesn't yet test all available functionality.
Signature · 3 lines
Søren O. "Oh, bother" said the Borg, "we've assimilated Pooh".