[prev in list] [next in list] [prev in thread] [next in thread] 

List:       licq-devel
Subject:    [Licq-devel] loading/unloading/listing plugins using fifo patch
From:       "Philip Nelson" <phatfil () optusnet ! com ! au>
Date:       2005-07-25 6:34:13
Message-ID: 61720.147.10.185.66.1122273253.squirrel () home ! whatsbeef ! net
[Download RAW message or body]

Here's a patch that lets you load/unload/list UI plugins using the fifo.
This is handy if you use licq from multiple locations, e.g you start licq
at home with the kde-gui, get to work and want to ssh and use the console
plugin - you can just load the console plugin without having licq quit (so
you stay online).

To do this you probably want to start licq from a screen session though,
as it's the terminal that you start licq from that the other plugins load
in. You may have to export your DISPLAY variable from the screen session
to get gui plugins to load properly.

Note that the name of the plugin you use may be different from the name
you have to unload it with, e.g:
echo "load_plugin kde-gui" > ~/.licq/licq_fifo
will load the kde-gui
whereas
echo "unload_plugin \"KDE GUI\"" > ~/.licq/licq_fifo
is needed to unload the kde-gui.

use echo "list_plugins" > ~/.licq/licq_fifo to find the name of the plugin
you want to unload.

Philip
["fifo.patch" (application/octet-stream)]

Index: doc/README.FIFO
===================================================================
RCS file: /cvsroot/licq/licq/doc/README.FIFO,v
retrieving revision 1.4
diff -r1.4 README.FIFO
72a73,82
> 
>   list_plugins
>     Lists the loaded UI plugins.
> 
>   load_plugin <plugin>
>     Loads the UI plugin called <plugin>.
> 
>   unload_plugin <plugin>
>     Unloads the UI plugin called <plugin>.
> 	Use list_plugins to see currently loaded UI plugins.
90d99
<   
\ No newline at end of file
Index: src/fifo.cpp
===================================================================
RCS file: /cvsroot/licq/licq/src/fifo.cpp,v
retrieving revision 1.16
diff -r1.16 fifo.cpp
109a110,119
> static const char* const HELP_PLUGINLIST = tr(
> 		"\tlist_plugins\n"
> 		"\t\tLists the loaded UI plugins\n");
> static const char* const HELP_PLUGINLOAD = tr(
> 		"\tload_plugin <plugin>\n"
> 		"\t\tLoads the UI plugin called <plugin>\n");
> static const char* const HELP_PLUGINUNLOAD = tr(
> 		"\tunload_plugin <plugin>\n"
> 		"\t\tUnloads the UI plugin called <plugin>.\n"
> 		"\t\tUse list_plugins to see currently loaded UI plugins.\n");
113d122
< 
647a657,715
> static int fifo_plugin_list(int argc, const char *const *argv, void *data)
> {
>   CICQDaemon *d = (CICQDaemon *) data;
>   PluginsList l;
>   PluginsListIter it;
> 
>   d->PluginList(l);
>   for (it = l.begin(); it != l.end(); it++)
>   {
>     gLog.Info("[%3d] %s\n", (*it)->Id(), (*it)->Name());
>   }
>   return 0;
> }
> 
> static int fifo_plugin_load(int argc, const char *const *argv, void *data)
> {
>   CICQDaemon *d = (CICQDaemon *) data;
>   PluginsList l;
>   PluginsListIter it;
> 
>   if (argc == 1)
>   {
>     ReportMissingParams(argv[0]);
>     return -1;
>   }
>   
>   char *sz[] = { "licq", NULL };
>   if (d->PluginLoad(argv[1], 1, sz))
>     return 0;
>   
>   gLog.Info("Couldn't load plugin '%s'\n", argv[1]);
>   return -1;
> }
> 
> static int fifo_plugin_unload(int argc, const char *const *argv, void *data)
> {
>   CICQDaemon *d = (CICQDaemon *) data;
>   PluginsList l;
>   PluginsListIter it;
> 
>   if( argc == 1 )
>   {
>     ReportMissingParams(argv[0]);
>     return -1;
>   }
>   
>   d->PluginList(l);
>   for (it = l.begin(); it != l.end(); it++)
>   {
>     if (strcmp((*it)->Name(), argv[1]) == 0)
>     {
>       d->PluginShutdown((*it)->Id());
> 	  return 0;
>     }
>   }
>   gLog.Info("Couldn't find plugin '%s'\n", argv[1]);
>   return -1;
> }
> 
694,708c762,779
<   {"status",       fifo_status,       HELP_STATUS,     0},
<   {"auto_response",fifo_auto_response,HELP_AUTO,       0},
<   {"message",      fifo_message,      HELP_MSG,        0},
<   {"url",          fifo_url,          HELP_URL,        0},
<   {"sms",          fifo_sms,          HELP_SMS,        0},
<   {"sms-number",   fifo_sms_number,   HELP_SMS_NUMBER, 0},
<   {"redirect",     fifo_redirect,     HELP_REDIRECT,   0},
<   {"debuglvl",     fifo_debuglvl,     HELP_DEBUGLVL,   0},
<   {"adduser",      fifo_adduser,      HELP_ADDUSER,    0},
<   {"userinfo",     fifo_userinfo,     HELP_USERINFO,   0},
<   {"exit",         fifo_exit,         HELP_EXIT,       0},
<   {"ui_viewevent", fifo_ui_viewevent, HELP_UIVIEWEVENT,0},
<   {"ui_message",   fifo_ui_message,   HELP_UIMESSAGE,  0},
<   {"help",         fifo_help,         HELP_HELP,       1},
<   {NULL,           NULL,              NULL,            0}
---
>   {"status",       fifo_status,       HELP_STATUS,       0},
>   {"auto_response",fifo_auto_response,HELP_AUTO,         0},
>   {"message",      fifo_message,      HELP_MSG,          0},
>   {"url",          fifo_url,          HELP_URL,          0},
>   {"sms",          fifo_sms,          HELP_SMS,          0},
>   {"sms-number",   fifo_sms_number,   HELP_SMS_NUMBER,   0},
>   {"redirect",     fifo_redirect,     HELP_REDIRECT,     0},
>   {"debuglvl",     fifo_debuglvl,     HELP_DEBUGLVL,     0},
>   {"adduser",      fifo_adduser,      HELP_ADDUSER,      0},
>   {"userinfo",     fifo_userinfo,     HELP_USERINFO,     0},
>   {"exit",         fifo_exit,         HELP_EXIT,         0},
>   {"ui_viewevent", fifo_ui_viewevent, HELP_UIVIEWEVENT,  0},
>   {"ui_message",   fifo_ui_message,   HELP_UIMESSAGE,    0},
>   {"list_plugins", fifo_plugin_list,  HELP_PLUGINLIST,   0},
>   {"load_plugin",  fifo_plugin_load,  HELP_PLUGINLOAD,   0},
>   {"unload_plugin",fifo_plugin_unload,HELP_PLUGINUNLOAD, 0},
>   {"help",         fifo_help,         HELP_HELP,         1},
>   {NULL,           NULL,              NULL,              0}

-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Licq-devel mailing list
Licq-devel@licq.org
https://lists.sourceforge.net/lists/listinfo/licq-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic