From: Marc G. K. <ma...@sq...> - 2005-11-09 20:30:42
|
On Wed, November 9, 2005 19:42, Paul Lesneiwski wrote: > > > Matthijs Wensveen wrote: > >> Paul Lesneiwski wrote: >> >> >>> Marc Groot Koerkamp wrote: >>> >>> >>> >>>> Hello Matthijs, >>>> >>>> >>>> On Mon, October 10, 2005 17:35, Matthijs Wensveen wrote: >>>> >>>> >>>> >>>> >>>>> Hello, >>>>> I just wanted to let you now that I've just submitted two patches >>>>> in the sourceforge patch-tracking system, 1322892 and 1322898, that >>>>> were needed to implement a plugin but thought were generic enough >>>>> to send you too. The first patch places a hook >>>>> (compose_send_successful) at the bottom of >>>>> deliverMessage just before sqimap_logout. The second patch makes >>>>> Deliver.class.php a little smarter. It gets $message passed by >>>>> reference so that updates to the object are noticable after >>>>> delivery. Also, it updates the $message object with the headers >>>>> generated in prepareRFC822_Header. >>>>> >>>>> For our plugin we really only needed the generated message_id, so >>>>> that we could fetch the sent mail from the imap server and process >>>>> it, but there were some other headers that seemed useful too. >>>>> >>>>> Let me know what you think of it.. >>>>> >>>>> >>>> >>>> If the GPG plugin keeps working we should use your patch. >>>> >>>> >>>> Brian (GPG developer), can you confirm if the gpg plugin still >>>> works with $message paste by reference? >>>> >>>> >>>> See >>>> http://sourceforge.net/tracker/index.php?func=detail&aid=1322898&gro >>>> up_id=311&atid=300311 >>>> >>>> >>> >>> >>> The post-send hook: >>> >>> >>> http://sourceforge.net/tracker/index.php?func=detail&aid=1322892&grou >>> p_id=311&atid=300311 >>> >>> >>> This has been asked for before, and I have been an advocate for >>> adding such a hook.... although I'm not sure if STABLE admins want to >>> add such a thing. IMO, something like this should go in DEVEL at >>> least (I would have done it anyway at some point), but I think its >>> placement is not right in this patch. I think we should put it before >>> the last return statement, outside of the if() block so that it gets >>> called for both successful (who (mis)spelled that $succes variable ;-) >>> ), and failed >>> sends. >>> >>> >>> >>> >>> >> Hmm... I think I agree, the placing of the hook should be outside of >> the if() block. The $succes variable is passed as a parameter anyway. >> Maybe we should do a search and replace of succes with success just to >> make it a little more tidy :) I also think it should be in DEVEL. Since >> the plugin we made is for internal use only, we can live with a patched >> stable for the moment. When the new stable is out, we might have to >> rewrite the plugin a little bit, but that is just the way it goes I >> guess. (but it would be nice to have a new stable as fast as possible :) >> ) >> > > I was going to do this back when this thread was active, but then ran > into a question that made me put it off... I hope Marc is reading this. Yes ;) > > Basically, I am not too sure if the hook should actually go inside of > the deliverMessage() function. I think that function will eventually go > away -- at some point, it will be VERY useful (for plugins and the like) > to have all that functionality abstracted into a function akin to PHP's > mail() function. Adding a hook in that context has different meaning and > implications than adding it elsewhere in src/compose.php after the call to > that function. > > In fact, I think I've just convinced myself. I believe that I will add > the hook OUTSIDE of that function, since the desired hook functionality > (from my perspective - correct me if you have other needs) is tied to > the concept of sending a mail from SM's compose screen. If we want to > later add a hook that is embedded in the delivery mechanism itself, that > should be different I think. > I agree. Outside the function, after the deliverMessage call is a much better place. I wonder why i didn't think of that before ;) > The outstanding question for Marc (or anyone who cares to go check), > then, is: there are TWO places in compose.php that call the > deliverMessage() function. One is in a "if ($draft)" block -- is the > function call there just putting a message into the drafts folder as > opposed to actually sending a mail? I suppose I can go test it, but a > quick answer from someone who already knows is easier. :) If my guess is > correct, I'll plan to add the hook after deliverMessage() in the *other* > place in compose.php > deliverMessage takes care of constructing the message and dependent of the initialised backend code it's delivered to an smtp server, sendmail server (by using the sendmail binary) or appending the message to an imap folder. The draft block calls deliverMessage to append the message to the draft folder. So the right place is indeed the *other* place. About the other patch, where the references are placed the the Deliver.class.php file, I think i should take care of it and apply the patch in the devel branch. Marc. |