Re: [Evolution-hackers] Mailing lista actions bounty patch



Hi Jorge,

Overall looks pretty good, but a few things are needed and some architectural changes too.

Put the "list-post" case in em-format.c:efh_format_header below all the address stuff, i.e. after the 'bcc' check.  Its a hell of a lot neater to look at.

em-format-html can't output any buttons (i.e. <object>/s) they have to be done in em-format-html-display.  But since this is a lot of work (need to virtualise some of the header output methods and move stuff around), and since i think this might not be the right approach anyway, it should probably be done via a url link instead of an object.

This could be done like this (it looks like a lot of work, but it isn't really, there's a lot of helper stuff in evolution).

- When we output the list-post header, we parse the address ourselves (rather than sending text to the text->html filter) , and output a mailto: uri, but add extra args, all of the list-post stuff we need later.  Do this using a CamelURL.  like

address = g_strdup_printf("mailto:%s", list_post);
url = "" NULL);
camel_url_set_param(url, "x-list-help", list_help);
camel_url_set_param(url, "x-list-unsubscribe", list_unsubscribe);

etc. (but do it similar to the way the popup callbacks are done, with paramaterised glue)
text = camel_url_to_string(url, 0);

Then create the anchor and embed the image reference too, hook the image in using similar code to the other image code.

Use efh_format_text_header to output the html (add EM_FORMAT_HTML_HEADER_HTML flag so it doesn't reformat it), dont just printf() it.

Don't check for mode == EM_FORMAT_NORMAL either, it should always be run if its got to this point.

- don't use camel_header_raw_check_mailing_list() to get the list address, use the list-post header to get a real address (the other is just a token, which may not be a valid address).

- Add a "EM_POPUP_URI_LIST" to the TARGET_URI enum in em-popup.h, and em_popup_taget_new_uri should be modified to set this on the target mask if the appropriate list arguments are set on the uri (again, use camel-url to parse the url and look for these parameters).  You could even only add the menu items if the corresponding header is set.

- put all the em-mailing-list-info callbacks into em-popup.c, and make them dependendent on EM_POPUP_URI_LIST (in emp_standard_uri_popups table).  Actually the callbacks will have to be different, they'll have to get their addresses from the uri parameters, but you wont need a list_post one either.


This way you get the same default behaviour - click on the link it sends to the list, but right-click will put up a merged menu suitable for mailto AND list addresses.  And we dont need em-mailing-list-info.[ch] anymore at all, and re-use the popup setup code.

Another (there's always another possibility) possibility from doing it this way is that you could do it 'implicitly' for other addresses displayed, e.g. if you have a cc to an address which matches list-post in the current message, you could add the icon and menu stuff to that mailto: link too.

And perhaps some suggestions for the menu names:

static EMPopupItem emml_menu_items[] = {
{ EM_POPUP_ITEM, "00.emml.00", N_("_List Help"), G_CALLBACK(sub_mailing_list_help), NULL, "faq-16.png", 0 },

-> "Request list help"

{ EM_POPUP_ITEM, "00.emml.01", N_("_Subscribe to list"), G_CALLBACK(sub_mailing_list_subscribe), NULL, NULL, 0 },
{ EM_POPUP_ITEM, "00.emml.02", N_("_Unsubscribe from list"), G_CALLBACK(sub_mailing_list_unsubscribe), NULL, NULL, 0 },
{ EM_POPUP_ITEM, "00.emml.03", N_("_Post a message to list"), G_CALLBACK(sub_mailing_list_post), NULL, NULL, 0 },
{ EM_POPUP_BAR, "10.emfv" },
{ EM_POPUP_ITEM, "10.emml.00", N_("List _Archives"), G_CALLBACK(sub_mailing_list_archives), NULL, NULL, 0 },

-> "View list archives"

};

And finally, the list-post parsing code needs to be more robust, it assumes the address is in a proper format (i.e. searhces for < followed by > and doesn't check if its not).  Needs to check all returns from calls to strchr, etc.  You also leak the url string!

Michael

On Sat, 2003-11-29 at 06:25, Jorge Bernal wrote:
I have finished coding the mailing list actions bounty[1]

I attach the patch and two icons for evolution/art/

mail-list.png is not used at this moment but can be used in mailing list
actions.

I  wait for your comments about the code :)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]