[Cream-browser-devel] Error code for creamctl API / plugin available
Status: Beta
Brought to you by:
linkdd
From: linkdd <li...@yd...> - 2010-07-16 14:59:37
|
Hi everybody, There is some news for Cream-Browser. ! SPAWN AND PLUGINS -------------------- First the function 'spawn' is available (for the socket and key-bindings). It allows you to execute an external program (or script). This program can use creamctl (or directly the socket) to talk with Cream-Browser and you're able to create a plugin in every language you want. ! ERROR CODE ------------- When you send a command to Cream-Browser socket, it send you an error code followed by the message (before, there was no error code ^^). This error code contains 3 numbers : 1. The error code of the parser 2. The error code common to all handlers 3. The specific error code for one handler For example: "310" - 3 : The error comes from the handler - 1 : There is an "ArgumentsError" (too few) - 0 : There is no specific error The first number can take those values : - 0 : NoError - 1 : ParsingError - 2 : UnknowFunction - 3 : FunctionError (that means the error comes from the function called) The second number take those values : - 0 : NoError - 1 : ArgumentsError (maybe too few arguments ?) - 2 : Undefined (that means the function exists but not yet available) - 3 : SpecificError (the error is specific to this handler, you must watch the documentation to see the possible error codes) And the third number take thoses values : - 0 : NoError - 1 : UnknowError - Defined by the function (see http://doc.cream-browser.net/group__handlers.html for more informations) ! THE FIRST PLUGIN ------------------- Here is the first plugin available ! :) It saves, or loads, the session (every buffer opened in Cream-Browser) : > #!/bin/sh > > save_session() > { > rm -rf ~/.config/cream-browser/session > > buffers=$(creamctl -s $1 -c "buffers") > for i in ${buffers#*: } > do > echo $i >> ~/.config/cream-browser/session > done > } > > load_session() > { > while read line > do > creamctl -s $1 -c "tabopen $line" > done < ~/.config/cream-browser/session > } > > case "$4" in > "save") save_session $3 ;; > "load") load_session $3 ;; > *) ;; > esac Enjoy! ;-) |