FreenetMessageInserter::FreenetMessageInserter(FreenetConnection *connection, FCPv2::Connection *fcp):IFCPConnected(fcp,connection),IPeriodicProcessor(connection),IFCPMessageHandler(connection,"MessageInserter") { FLIPEventSource::RegisterFLIPEventHandler(FLIPEvent::EVENT_IRC_CHANNELMESSAGE,this); FLIPEventSource::RegisterFLIPEventHandler(FLIPEvent::EVENT_IRC_PRIVATEMESSAGE,this); FLIPEventSource::RegisterFLIPEventHandler(FLIPEvent::EVENT_IRC_JOINCHANNEL,this); FLIPEventSource::RegisterFLIPEventHandler(FLIPEvent::EVENT_IRC_PARTCHANNEL,this); FLIPEventSource::RegisterFLIPEventHandler(FLIPEvent::EVENT_IRC_KEEPALIVE,this); FLIPEventSource::RegisterFLIPEventHandler(FLIPEvent::EVENT_IRC_SETTOPIC,this); Option option; option.Get("MessageBase",m_messagebase); option.Get("MessageInsertPriority",m_insertpriority); }
void handleoptions(const std::vector<std::string> &options, bool &startup) { Option option; std::string val(""); for(std::vector<std::string>::const_iterator i=options.begin(); i!=options.end(); i++) { std::string::size_type pos=(*i).find("="); if((*i).size()>3 && (*i).substr(0,2)=="--" && pos!=std::string::npos) { if(option.Get((*i).substr(2,pos-2),val)==true) { option.Set((*i).substr(2,pos-2),(*i).substr(pos+1)); startup=false; } } else { if((*i)=="--help" || (*i)=="-?" || (*i)=="/?") { showhelp(); startup=false; } if((*i)=="--daemon") { Daemonize(); global::daemon=true; } } } }
void Init(int64 wnd) { hwnd = wnd; int row = 0; //SetData("-- Regular styles --"); Ready(false); StaticText *st; Add(0, 0, 0); st = new StaticText; *st= "-- click me --"; *st <<= THISBACK(Action); GetList().SetCtrl(0, 0, st); ++row; Add(0, 0, 0); st = new StaticText; *st = "-- Regular styles --"; GetList().SetCtrl(1, 0, st); ++row; Option *po; for(int i = 0; i < sizeof(styles)/sizeof(styles[0]); ++i, row++) { po = new Option; po->Set((stylesbits[i]&GetWindowLong((HWND)hwnd, GWL_STYLE) ? true : false)); po->SetLabel(styles[i]); *po <<= THISBACK(Action); Add(po->Get(), ::Format("0x%08x", (int64)stylesbits[i]), *(int64*)&stylesbits[i]); GetList().SetCtrl(row, 0, po); } Add(0, 0); st = new StaticText; *st = "** Extendes styles **"; GetList().SetCtrl(row, 0, st); ++row; for(int i = 0; i < sizeof(exstyles)/sizeof(exstyles[0]); row++, ++i){ po = new Option; po->Set((stylesbits[i]&GetWindowLong((HWND)hwnd,GWL_EXSTYLE)) ? true : false); po->SetLabel(exstyles[i]); *po <<= THISBACK(Action); Add(po->Get(), ::Format("0x%08x", (int64)exstylesbits[i]), *(int64*)&exstylesbits[i]); GetList().SetCtrl(row, 0, po); } Ready(true); /*GetList().SetCursor(0); SetIndex(0); SetData("-- click me --");*/ }
void Autonomous(){ Option *num = (Option *) chooser->GetSelected(); myRobot->ResetDisplacement(); Modes->SetMode(num->Get()); Modes->Run(); while(IsAutonomous() && IsEnabled()){ Wait(0.05); Scheduler::GetInstance()->Run(); } }