Changeset 4893 for branches/erijo-dev

Show
Ignore:
Timestamp:
04/14/07 07:09:11 (20 months ago)
Author:
erijo
Message:

Create a plugin instance

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/erijo-dev/licq/src/daemon.cpp

    r4889 r4893  
    1919 
    2020#include "daemon.h" 
     21#include "plugin/plugininstance.h" 
    2122 
    2223#include <sys/time.h> 
     
    123124  Log.debug("Done rebuilding plugin cache."); 
    124125 
     126  IPlugin* p = PluginRepository->createPlugin("TestPlugin"); 
     127  assert(p != NULL); 
     128   
     129  TPluginInstance instance(p); 
     130  const bool init = instance.init(TStringList()); 
     131  assert(init == true); 
     132  if (!init) return -1; 
     133  instance.getThread()->start(); 
     134 
    125135  EventLoop.addTimer(1000, this); 
    126136  EventLoop.addTimer(500, this); 
     
    129139                              TEventLoop::ACTION_READ_FD, this); 
    130140 
     141  IEventPtr event = IEvent::create(0, "hello"); 
     142  event->setProperty("text", "Hello World!"); 
     143  instance.getEventQueue()->push(event); 
     144 
    131145  const int ret = EventLoop.run(); 
     146 
     147  instance.getThread()->cancel(); 
     148  instance.getThread()->join(); 
     149 
    132150  if (ret != 0) 
    133151    Log.error("Daemon exited with non-zero exit code (%d)", ret);