Closed
Bug 262037
(czpluginapi)
Opened 21 years ago
Closed 21 years ago
we need a better plugin API
Categories
(Other Applications Graveyard :: ChatZilla, defect)
Other Applications Graveyard
ChatZilla
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: samuel, Assigned: samuel)
References
Details
Attachments
(5 files, 2 obsolete files)
|
9.66 KB,
patch
|
rginda
:
review+
|
Details | Diff | Splinter Review |
|
9.98 KB,
patch
|
Details | Diff | Splinter Review | |
|
935 bytes,
patch
|
rginda
:
review+
|
Details | Diff | Splinter Review |
|
1.17 KB,
patch
|
bugzilla-mozilla-20000923
:
review+
|
Details | Diff | Splinter Review |
|
3.27 KB,
text/plain
|
Details |
First draft:
ChatZilla provides "PluginAPI" containing the version number in the plugin's scope.
The plugin on loading must set a variable named "API" in the scope containing
the version number that it provides.
API version 1:
plugin must provide the following functions:
initPlugin: does any initialization the plugin needs, but does not enable it.
enablePlugin: does whatever is required to activate the plugin. returns a
boolean indicating whether or not the plugin was successfully enabled.
disablePlugin: does whatever is required to deactivate the plugin. returns a
boolean indicating whether or not the plugin was successfully disabled.
ChatZilla will provide the following capabilities:
on the first load of the plugin, it will attempt to enable the plugin.
it will remember the state of the plugin, and on following loads, it will enable
the plugin only if it was enabled the last time ChatZilla was closed.
enablePlugin will not be called if the plugin is already enabled.
disablePlugin will not be called if the plugin is already disabled.
Comment 1•21 years ago
|
||
I want to suggest that the variable containing the API version be plugin.API
rather than plugin.scope.API. We already have variables, plugin.id,
plugin.description, plugin.version, &c. In other words, this new variable
should be in the same scope as the id, description, and version, rather than the
variable-space of the plugin itself.
Comment 2•21 years ago
|
||
The reason these functions were in the global scope the first time around, is
that I assumed it would be easier for the unwashed masses to understand. I'm
not really tied to that though. Moving them to the plugin object could be a
good way to distinguish old/new style plugins.
| Assignee | ||
Comment 3•21 years ago
|
||
Draft 2:
Remove the requirement for the API variable.
Instead, the functions must be put on the plugin object.
initPlugin -> plugin.init
enablePlugin -> plugin.enable
disablePlugin -> plugin.disable
This will enable chatzilla to determine if it's a new plugin or an old plugin.
| Assignee | ||
Comment 4•21 years ago
|
||
Update:
plugin.id must be set to a unique name for the plugin. The only valid
characters for the id are A-Z a-z 0-9 and _.
The plugin's prefs will be found at extensions.irc.plugins.<id> in the pref tree.
ChatZilla will set plugin.prefs and plugin.prefManager to be the prefs branch
and pref manager for the plugin.
| Assignee | ||
Comment 5•21 years ago
|
||
Oops, "-" is also valid in the id.
| Assignee | ||
Comment 6•21 years ago
|
||
More details on prefs:
An inital prefs array will be created before calling init() and stored in
plugin.prefary. The init() function can add any more it needs to that array and
the prefManager will be created after init() returns.
If there is a function called plugin.onPrefChanged, then it will be set as the
pref observer.
If anyone can come up with a reason why init() will need to be accessing prefs
instead of in enable(), then let me know because we couldn't come up with a
scenario where that would be necessary.
| Assignee | ||
Comment 7•21 years ago
|
||
One more thing to add since I'm sure it will be a FAQ if it's not included.
plugin.cwd will contain the url to the plugin's working directory.
| Assignee | ||
Comment 8•21 years ago
|
||
| Assignee | ||
Comment 9•21 years ago
|
||
Comment on attachment 162317 [details] [diff] [review]
new API
The "networks." part of the pref branch shouldn't be there and has been removed
locally.
Attachment #162317 -
Flags: review?(rginda)
Comment 10•21 years ago
|
||
Comment on attachment 162317 [details] [diff] [review]
new API
r=rginda
Attachment #162317 -
Flags: review?(rginda) → review+
| Assignee | ||
Comment 11•21 years ago
|
||
| Assignee | ||
Comment 12•21 years ago
|
||
Comment 13•21 years ago
|
||
The |id| is still being passed in... perhaps that could be changed to |url| or
dropped entirely?
| Assignee | ||
Comment 14•21 years ago
|
||
Attachment #163164 -
Attachment is obsolete: true
| Assignee | ||
Updated•21 years ago
|
Attachment #163178 -
Flags: review?(rginda)
Comment 15•21 years ago
|
||
Comment on attachment 163178 [details] [diff] [review]
update take 2
How about dong the index assignment in the var declaration, instead of the if
() clause?
r=rginda with that change
Attachment #163178 -
Flags: review?(rginda) → review+
Comment 16•21 years ago
|
||
this is mostly known, but just to have it written down:
/disable-plugin and /enable plugin both give errors due to attempts to set a
preference on old-style plugins when no preferences exist (enabled=false is the
pref)
| Assignee | ||
Comment 17•21 years ago
|
||
Not very useful, but shows how to use prefs, proper enable() and disable(),
etc.
| Assignee | ||
Comment 18•21 years ago
|
||
Updated•21 years ago
|
Attachment #165063 -
Flags: review+
Comment 19•21 years ago
|
||
Comment on attachment 165063 [details] [diff] [review]
fix enable/disable issues with oldstyle plugins
Checked in.
Updated•21 years ago
|
Product: Core → Other Applications
Comment 20•21 years ago
|
||
I believe everything from this bug is now FIXED.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
| Assignee | ||
Comment 21•21 years ago
|
||
Attachment #163871 -
Attachment is obsolete: true
| Assignee | ||
Updated•21 years ago
|
Alias: czpluginapi
Comment 22•20 years ago
|
||
please allow ALEXA tOOLBAR
Updated•1 year ago
|
Product: Other Applications → Other Applications Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•