[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  UnloadPlugin function

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: UnloadPlugin function
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please)
Maximum of 6000 characters. Text only please, no HTML.
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Sun 08 May 2011 05:14 AM (UTC)  quote  ]

Amended on Sun 08 May 2011 05:15 AM (UTC) by Fiendish

Message
Quote:
Is your big problem that, even if the plugin disables itself, it is still in the plugin list, and will show up again next time?
Yup. And the appropriate state variable juggling to re-disable it again on next load breaks my desire #4.

Quote:
Added UnloadPlugin to version 4.73.

Cool. :)

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sun 08 May 2011 02:28 AM (UTC)  quote  ]
Message
Added UnloadPlugin to version 4.73.

https://github.com/nickgammon/mushclient/commit/5072cd1e

I concede that if you can reload a plugin (which effectively deletes it for a while) you may as well be able to unload it without reloading it.

To be consistent with ReloadPlugin a plugin cannot itself. You would need to schedule an unload on a timer (which is what MUSHclient would have to do anyway to make that work).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 07 May 2011 10:47 PM (UTC)  quote  ]
Message
You want plugin X to load and as if the user wants to use the features in X? And if they say "no" X has to kill itself?

Is your big problem that, even if the plugin disables itself, it is still in the plugin list, and will show up again next time?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Sat 07 May 2011 04:43 PM (UTC)  quote  ]
Message
Quote:
Why won't it work out?

I had the following design goals:

1) On the very first run, ask the user if they want a task to get run every time MUSHclient loads.
2) If the user chooses "yes", then run the task in question every time MUSHclient loads.
3) If the user chooses "no", then never run the task in question.
4) Don't permanently save state about the choice in the plugin itself, because there should be a way to change the decision /without/ making the user try to remember some secret command that they will quickly forget anyway because it is something they will very very rarely use.

My initial design had this completely self-contained and would just have the plugin unload itself if the user chose "no". My second design, which violates the golden design principle (haha) of keeping plugins from interacting with each other is to have the question presented by a different plugin that optionally loads this plugin if the user chooses "yes".

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Sat 07 May 2011 03:20 AM (UTC)  quote  ]

Amended on Sat 07 May 2011 03:21 AM (UTC) by Fiendish

Message
Quote:
kill -9 myplugin.xml

Wait...seriously? Hahaha. I think somehow that that won't prevent it from loading the next time. Anyway I worked out a different solution. Telling users to manually remove it instead of doing it for them.

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Sat 07 May 2011 03:16 AM (UTC)  quote  ]
Message
Aww, but at least give it a chance to clean up.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 07 May 2011 03:08 AM (UTC)  quote  ]
Message
Why won't it work out?

Anyway, try this:


kill -9 myplugin.xml


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Sat 07 May 2011 02:08 AM (UTC)  quote  ]
Message
Actually, no, disabling it just doesn't seem like it will work out. Bummer.

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Fiendish   USA  (848 posts)  [Biography] bio   Global Moderator
Date Fri 06 May 2011 11:07 PM (UTC)  quote  ]

Amended on Fri 06 May 2011 11:08 PM (UTC) by Fiendish

Message
Oddly enough, I have a use case where I want a plugin to unload itself. ^_^
I suppose I'll have to settle for just disabling it. Gee, I hope I can disable a plugin from inside itself. :\

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Mon 07 Mar 2011 07:31 AM (UTC)  quote  ]

Amended on Mon 07 Mar 2011 07:33 AM (UTC) by Twisol

Message
Nick Gammon said:
Well, let's see. Plugins are supposed to be self-contained extensions. Thus plugin A shouldn't need to unload plugin B. And plugin A can't unload itself because it has the address and scripting space yanked out from under it.

By that logic, LoadPlugin, ReloadPlugin, and even CallPlugin shouldn't exist either, as they disrupt the self-containment abstraction.

I think we've already established that plugins can depend on other plugins. The LoadPlugin documentation itself suggests the possibility of a "plugin manager" plugin. I'm simply following the logic: if you can load plugins, it seems odd that you can't do the inverse.

Nick Gammon said:
In Windows for example, can Excel "unload" Word?

I'm not sure that's a fair comparison. Excel and Word are separate programs; they're not extensions to a common host.

(That said, I'm pretty sure it's possible to kill one process from another.)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Mon 07 Mar 2011 06:30 AM (UTC)  quote  ]
Message
Well, let's see. Plugins are supposed to be self-contained extensions. Thus plugin A shouldn't need to unload plugin B. And plugin A can't unload itself because it has the address and scripting space yanked out from under it.

In Windows for example, can Excel "unload" Word?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Mon 07 Mar 2011 04:57 AM (UTC)  quote  ]

Amended on Mon 07 Mar 2011 05:00 AM (UTC) by Twisol

Message
This isn't so much a feature request as it is a question. Why are there LoadPlugin() and ReloadPlugin() functions, but no complementary UnloadPlugin() function? No, I can't honestly say I have a use-case - I'm just playing with yet another wrapper interface, and its absence surprised me.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] 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.


2,288 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]