Hi Garret, I just finished reading the whole tarball you sent me. It's very interesting. I'm planning to make some modifications on it to provide a generic new API for sending data (I also have a new dpi for file:/, some fixes for buffering in the transfer for bookmarks, some changes to downloads, also to consider cookies and preferences). BTW, with bookmarks I had already changed the data sending routines to provide for streams and flushing. Something like: <q> int send_data_chunk(int OutFD, char *Data, size_t DataSize, int flush); int send_data_string(int OutFD, char *str, int flush); </q> that provides for better tunning from each dpi (e.g. the new bookmarks transfers also run quickly on the 2.6.x series of the linux kernel). The idea of grouping common functions into something like a dpi library was present from a long time ago. This is a good opportunity to start with it. :) I have to think a bit more about the API for data sending. The plan is to have it merged on CVS before Friday. On Mon, 12 Jul 2004, Garrett Kajmowicz wrote:
Something with the DPI instrastructure needs to be considered - what to do if a plugin needs to prompt the user for some information.
Yes, this was considered. ...and it is much like what you describe.
The need for this first came about while developping the https plugin - there needs to be a way to prompt the user in the event that the foreign system isn't trusted.
This can currently be done through the use of direct calls to Gtk (I assume), but this is not the best result. It requires that everybody who needs to do user prompting write their own dialogs. It creates additional dependancies for the dpis. And it makes code upgrades more difficult - Should Dillo switch to another toolkit in the future for whatever reason (perhaps Gtk2?), all of the DPIs need to be rewritten. And in the event of multiple instances of Dillo running, it becomes impossible to determine which instance the prompt is for.
Yes, those are the two possibilities: a) Dialogs through Dillo (using dpip). b) Native dialogs. Currently b) seems inadequate, but for graphical dpis, it's different (for instance the graphical downloads: it's simpler to add "cancel" buttons in the native window). In the case of https, a) looks better.
My proposed solution to this problem is to create a new dpi command which is used to prompt the user for what to do. It should allow (require/default?) modal dialog boxes so that the prompt is associated with the Dillo instance the plugin is using.
I am suggesting that the dpi command be 'prompt_user'. There would be one manditory field, 'type' which would indicate the type of prompt to use. Example values might be 'dialog' or 'file_save'. These types would be extensible.
From there, additional tags would be allocated based on the type of prompt. For example, a 'file_save' prompt might have a default_filename tag. A 'dialog' would likely have a title, a message, and up to 3 button texts.
In all cases, the responce should be a dpi message of type 'user_response' with a 'response' tag holding the value of the user input.
I'll have to search my archives. I'm sure I wrote something about this long ago... AFAIR, there was the "question dialog" with fixed alternatives, and things like that. In the https case, it seems we only need (by now) a yes/no answer for a certificate that can't be verified. Please send me the list for all the question/generic dialogs you foresee.
At least this is my proposal. I'd like some feedback on it, and especially suggestions or better ideas.
The question dialog through dpip for continuing or aborting over non-verifiable certificates, is the bottle-neck now. I'll start coding it ASAP. Of course it would be very helpful to know in advance the other possible dialogs. To design a good API, that is. Cheers Jorge.-