Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ An OnPluginListChanged question
An OnPluginListChanged question
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Sun 03 Jan 2010 05:40 AM (UTC) Amended on Sun 03 Jan 2010 05:42 AM (UTC) by Twisol
|
Message
| I'm messing around with some plugin dependency things right now, and a bit of an issue came up. The plugin I'm working on currently depends on the ATCP plugin, and when the plugin list changes (i.e. after all plugins are guaranteed to be loaded), I use CallPlugin() to call a function defined in the ATCP plugin.
The issue is that I can't see any unobtrusive way to -only- run the CallPlugin() when it's the ATCP plugin that's just been (re)installed. Right now, it's called whenever any plugin is reinstalled, which isn't exactly something I'd like happening.
Would anyone happen to have any suggestions on how to get around this? In case it's useful, here's the OnPluginListChanged I'm using:
OnPluginListChanged = function()
local atcp = PPI.Load("7c08e2961c5e20e5bdbf7fc5")
if not atcp then
error("ATCP plugin not installed. Please install the ATCP plugin, then reinstall this plugin.")
end
_G["atcp"] = atcp
atcp.EnableModule("room_brief")
end
(If you're wondering, PPI is a library script I wrote to encapsulate some inter-plugin communication. It's related to my previous LoadPPI, except it uses CallPlugin() directly, and doesn't have the load-on-demand functionality.) |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sun 03 Jan 2010 09:41 AM (UTC) |
Message
| Just so I understand the question, are you saying that if plugins A, B and C were previously installed, and then B was reinstalled, you want a way of knowing that B has changed but not A or C?
I don't know if it would help, but B itself would know if it had been reinstalled.
In other words, your ATCP plugin could detect if an attempt was made to EnableModule twice for some module (or any module) by keeping track of whether it had been enabled before in a table. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #2 on Sun 03 Jan 2010 03:41 PM (UTC) |
Message
| Sure, but if you did something much less repeatable - for example, sending something to the world - then it's undesirable no matter how you look at it.
B itself knows it's been reinstalled, and could certainly send a broadcast message to interested parties... but then we're back to square one, before OnPluginListChanged was implemented. =/ |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 03 Jan 2010 07:35 PM (UTC) |
Message
| I have added selector 22 to GetPluginInfo. This is the date/time the plugin was installed (to the nearest second).
Thus any plugin can store that information for any other plugin. If the date/time of the target plugin changes, then that plugin has been reinstalled. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #4 on Sun 03 Jan 2010 07:39 PM (UTC) |
Message
| Ahh, great! Thanks, Nick. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
10,927 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top