public PrefsHook() { // preference storage can be done in many different // ways. We could use the Windows Registry, or we // can write an XML file, in this case we will use // a .net Dictionary object using string pairs. m_prefsHook = this; prefDict = new Dictionary<string, string>(); }
private void Run(string username, string password, string limitedUser) { try { // create control to allow invokes CreateControl(); useLimitedUser = (limitedUser.Equals("1") ? true : false); // create and init session object o; AccCreateSession(typeof(IAccSession).GUID, out o); s = (AccSession)o; // create the delegate that the Timer will call TimerCallback tc = new TimerCallback(BotTimer); timer = new TimerClass(tc, null, TIMER_INTERVAL*1000, TIMER_INTERVAL*1000); // start the thread that will terminate processes ThreadStart job = new ThreadStart(KillProcessesJob); killProcessesThread = new Thread(job); killProcessesThread.Start(); // create our preference hook and then pass it // to Open AIM PrefsHook prefs = new PrefsHook(); // the folder where to store all of the downloaded files prefs.SetValue("aimcc.connect.disableLocalRateLimits", "-1"); s.PrefsHook = prefs; // set up the listeners to AIM events. Visual Studio will help you with // adding these functions by auto completing the functions. s.OnStateChange += new DAccEvents_OnStateChangeEventHandler(s_OnStateChange); s.OnSecondarySessionStateChange += new DAccEvents_OnSecondarySessionStateChangeEventHandler(s_OnSecondarySessionStateChange); s.OnImReceived += new DAccEvents_OnImReceivedEventHandler(s_OnImReceived); // file xfer stuff s.OnNewFileXfer += new DAccEvents_OnNewFileXferEventHandler(s_OnNewFileXfer); s.OnFileXferProgress += new DAccEvents_OnFileXferProgressEventHandler(s_OnFileXferProgress); s.OnFileXferComplete += new DAccEvents_OnFileXferCompleteEventHandler(s_OnFileXferComplete); s.OnFileXferCollision += new DAccEvents_OnFileXferCollisionEventHandler(s_OnFileXferCollision); // here is where we put the name of our client and developer key. // you will replace 'acshbuddy' with your client name and replace // 'ju1yztKT86VJ0xj3' with your custom client key // get your key at http://dev.aol.com/openaim s.ClientInfo.set_Property(AccClientInfoProp.AccClientInfoProp_Description, "CodeRemote (key=co1tf1ToCrIxczUe)"); Console.WriteLine("trying to sign on.."); // set the user name on the session s.Identity = username; // sign on to AIM m_userName = username; m_passWord = password; s.SignOn(password); Console.WriteLine("successfully signed on!"); // start main loop Application.Run(); } catch (COMException e) { Console.WriteLine(e.Message); } }