示例#1
0
        public override void Connect(FrontendManager fm, ServerModel server)
        {
            Trace.Call(fm, server);

            if (fm == null)
            {
                throw new ArgumentNullException("fm");
            }
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }

            _FrontendManager = fm;
            Host             = "login.oscar.aol.com";
            Port             = 5190;

            // TODO: use config for single network chat or once per network manager
            _NetworkChat = new ProtocolChatModel(NetworkID, NetworkID + " Messenger", this);
            Session.AddChat(_NetworkChat);
            Session.SyncChat(_NetworkChat);

            _OscarSession = new OscarSession(server.Username, server.Password);
            _OscarSession.ClientCapabilities        = Capabilities.Chat | Capabilities.OscarLib;
            _OscarSession.LoginCompleted           += new LoginCompletedHandler(_OnLoginCompleted);
            _OscarSession.LoginFailed              += new LoginFailedHandler(_OnLoginFailed);
            _OscarSession.LoginStatusUpdate        += new LoginStatusUpdateHandler(_OnLoginStatusUpdate);
            _OscarSession.ErrorMessage             += new ErrorMessageHandler(_OnErrorMessage);
            _OscarSession.WarningMessage           += new WarningMessageHandler(_OnWarningMessage);
            _OscarSession.StatusUpdate             += new InformationMessageHandler(_OnStatusUpdate);
            _OscarSession.ContactListFinished      += new ContactListFinishedHandler(_OnContactListFinished);
            _OscarSession.Messages.MessageReceived += new MessageReceivedHandler(_OnMessageReceived);
            _OscarSession.Logon(Host, Port);
        }
示例#2
0
        private void _OnLoginCompleted(OscarSession sess)
        {
            IsConnected = true;

            string msg = _("Login successful");

            Session.AddTextToChat(_NetworkChat, "-!- " + msg);
        }
示例#3
0
        public SMSManager(string name, string pw)
        {
            sess = new Session(name, pw);
            //sess.InitializeLogger(Environment.CurrentDirectory);

            sess.ClientCapabilities = Capabilities.Chat | Capabilities.SendFiles | Capabilities.OscarLib |
                Capabilities.DirectIM;
        }
示例#4
0
        private ulong statsIntervalMins = 1200 * 60; // 1200 Hours is default

        #endregion Fields

        #region Constructors

        internal UsageStatsManager(Session parent)
        {
            this.parent = parent;
            parent.Dispatcher.RegisterSnacFamilyHandler(this, SNAC_USAGESTATS_FAMILY);

            //statsTimer = new Timer(60000);
            //statsTimer.Elapsed += new ElapsedEventHandler(statsTimerCallback);
            //statsTimer.Start();
        }
示例#5
0
文件: Main.cs 项目: pkt30/OscarLib
        public MainClass(string name, string pw)
        {
            sess = new Session(name, pw);
            sess.InitializeLogger(Environment.CurrentDirectory);

            sess.ClientCapabilities = Capabilities.SendFiles | Capabilities.OscarLib | Capabilities.AIMtoICQ;
            sess.SetDefaultIdentification();

            sess.LoginCompleted += new LoginCompletedHandler(sess_LoginCompleted);
            sess.ErrorMessage += new ErrorMessageHandler(sess_ErrorMessage);
            sess.WarningMessage += new WarningMessageHandler(sess_WarningMessage);
            sess.StatusUpdate += new InformationMessageHandler(sess_StatusUpdate);
            sess.LoginFailed += new LoginFailedHandler(sess_LoginFailed);

            sess.Statuses.UserStatusReceived += new UserStatusReceivedHandler(sess_UserStatusReceived);
            sess.Statuses.UserInfoReceived += new UserInfoReceivedHandler(sess_UserInfoReceived);

            sess.MasterGroupItemReceived += new MasterGroupItemReceivedHandler(sess_MasterGroupItemReceived);
            sess.GroupItemReceived += new GroupItemReceivedHandler(sess_GroupItemReceived);
            sess.BuddyItemReceived += new BuddyItemReceivedHandler(sess_BuddyItemReceived);
            sess.ContactListFinished += new ContactListFinishedHandler(sess_ContactListFinished);

            sess.ChatInvitationReceived += new ChatInvitationReceivedHandler(sess_ChatInvitationReceived);
            sess.ChatRooms.ChatRoomJoined += new ChatRoomJoinedHandler(sess_ChatRoomCreated);

            sess.DirectIMRequestReceived += new DirectIMRequestReceivedHandler(sess_DirectIMRequestReceived);
            sess.DirectIMReceived += new DirectIMReceivedHandler(sess_DirectIMReceived);

            sess.Messages.TypingNotification += new TypingNotificationEventHandler(sess_TypingNotification);
            sess.Messages.MessageReceived += new MessageReceivedHandler(sess_MessageReceived);
            sess.Messages.OfflineMessagesReceived += new OfflineMessagesReceivedEventHandler(ICQ_OfflineMessagesReceived);
            sess.Messages.MessageDeliveryUpdate += new MessageDeliveryUpdateEventHandler(Messages_MessageDeliveryUpdate);

            sess.Graphics.AutoSaveLocation = Environment.CurrentDirectory;
            sess.Graphics.BuddyIconDownloaded += new BuddyIconDownloadedHandler(Graphics_BuddyIconDownloaded);
            sess.Graphics.BuddyIconUploadCompleted += new BuddyIconUploadCompletedHandler(Graphics_BuddyIconUploadCompleted);
            sess.Graphics.BuddyIconUploadFailed += new BuddyIconUploadFailedHandler(Graphics_BuddyIconUploadFailed);

            sess.FileTransferProgress += new FileTransferProgressHandler(sess_FileTransferProgress);
            sess.FileTransferCompleted += new FileTransferCompletedHandler(sess_FileTransferCompleted);
            sess.FileTransferRequestReceived += new FileTransferRequestReceivedHandler(sess_FileTransferRequestReceived);
            sess.FileTransferCancelled += new FileTransferCancelledHandler(sess_FileTransferCancelled);

            sess.ICQ.ShortUserInfoReceived += new ShortUserInfoReceivedHandler(Icq_ShortUserInfoReceived);
            sess.ICQ.FullUserInfoReceived += new FullUserInfoReceivedHandler(Icq_FullUserInfoReceived);

            Login(sess);
        }
示例#6
0
文件: Main.cs 项目: pkt30/OscarLib
 private void sess_FileTransferCompleted(Session sess, Cookie cookie)
 {
     filecookie = null;
     Console.WriteLine("File transfer of {0} complete", cookie.ToString());
 }
示例#7
0
 /// <summary>
 /// Initializes a new GraphicsManager
 /// </summary>
 internal GraphicsManager(Session parent)
 {
     this.parent = parent;
     parent.Dispatcher.RegisterSnacFamilyHandler(this, SNAC_BART_FAMILY);
 }
示例#8
0
文件: Main.cs 项目: pkt30/OscarLib
 private void sess_FileTransferCancelled(Session sess, UserInfo other, Cookie cookie, string reason)
 {
     filecookie = null;
     Console.WriteLine("FileTransferCancelled " + reason + " " + other.ScreenName);
 }
示例#9
0
 private void _OnLoginFailed(OscarSession sess, LoginErrorCode errorCode)
 {
     string msg = String.Format(_("Login failed: {0}"), errorCode);
     Session.AddTextToChat(_NetworkChat, "-!- " + msg);
 }
示例#10
0
 private void _OnStatusUpdate(OscarSession sess, string message)
 {
     Session.AddTextToChat(_NetworkChat, "-!- Status: " + message);
 }
示例#11
0
文件: Main.cs 项目: pkt30/OscarLib
        private void sess_GroupItemReceived(Session sess, SSIGroup group)
        {
            //groups[index].group = group;

            //Console.WriteLine(String.Format("Received Group({0}): {1}", index, group.Name));
            //if (group.Children != null)
            //{
            //  groups[index].buddies = new SSIBuddy[group.Children.GetLength(0)];

            //  Console.WriteLine("Children:");
            //  foreach (ushort childid in group.Children)
            //  {
            //    Console.WriteLine("  {0}", childid);
            //  }
            //}
            Console.WriteLine(String.Format("Received Group({0}): {1}", group.ID, group.Name));
        }
示例#12
0
        private void _OnLoginFailed(OscarSession sess, LoginErrorCode errorCode)
        {
            string msg = String.Format(_("Login failed: {0}"), errorCode);

            Session.AddTextToChat(_NetworkChat, "-!- " + msg);
        }
示例#13
0
文件: Main.cs 项目: pkt30/OscarLib
 private void sess_LoginFailed(Session sess, LoginErrorCode reason)
 {
     Console.WriteLine(reason);
 }
示例#14
0
文件: Main.cs 项目: pkt30/OscarLib
 private void sess_StatusUpdate(Session sess, string message)
 {
     Console.WriteLine("Status: " + message);
 }
示例#15
0
        /// <summary>
        /// Initializes a new ServiceManager
        /// </summary>
        internal ServiceManager(Session parent)
        {
            this.parent = parent;
            parent.Dispatcher.RegisterSnacFamilyHandler(this, SNAC_BOS_FAMILY);

            this.AuthCookie = (new Random()).Next(int.MinValue, int.MaxValue);
        }
示例#16
0
文件: Main.cs 项目: pkt30/OscarLib
        public void Login(Session sess)
        {
            //sess.Logon("login.oscar.aol.com", 5190);

            //sess.Logon();
            sess.Logon("login.icq.com", 5190, false);
            //sess.Logon("slogin.icq.com", 443, true);
        }
示例#17
0
        private void _OnContactListFinished(OscarSession sess, DateTime time)
        {
            Session.AddTextToChat(_NetworkChat, "-!- Contact list finished");

            _OscarSession.ActivateBuddyList();
        }
示例#18
0
        private void _OnWarningMessage(OscarSession sess, ServerErrorCode errorCode)
        {
            string msg = String.Format(_("Connection Warning: {0}"), errorCode);

            Session.AddTextToChat(_NetworkChat, "-!- " + msg);
        }
示例#19
0
 private void _OnStatusUpdate(OscarSession sess, string message)
 {
     Session.AddTextToChat(_NetworkChat, "-!- Status: " + message);
 }
示例#20
0
文件: Main.cs 项目: pkt30/OscarLib
 private void sess_FileTransferProgress(Session sess, Cookie cookie, uint BytesTransfered, uint BytesTotal)
 {
     Console.WriteLine("Transfered {0} of {1} of {2}", BytesTransfered, BytesTotal, cookie.ToString());
 }
示例#21
0
 /// <summary>
 /// Initializes a new AuthorizationManager
 /// </summary>
 internal AuthorizationManager(Session parent)
 {
     this.parent = parent;
     parent.Dispatcher.RegisterSnacFamilyHandler(this, SNAC_AUTH_FAMILY);
 }
示例#22
0
文件: Main.cs 项目: pkt30/OscarLib
 private void sess_FileTransferRequestReceived(Session sess, UserInfo sender, string IP, string filename, uint filesize, string message, Cookie key)
 {
     filecookie = key;
     Console.WriteLine("Auto-accepting " + filename);
     sess.AcceptFileTransfer(key, "C:\\recv_" + filename);
 }
示例#23
0
        private void _OnContactListFinished(OscarSession sess, DateTime time)
        {
            Session.AddTextToChat(_NetworkChat, "-!- Contact list finished");

            _OscarSession.ActivateBuddyList();
        }
示例#24
0
文件: Main.cs 项目: pkt30/OscarLib
 private void sess_LoginCompleted(Session sess)
 {
     Console.WriteLine("Login complete");
 }
示例#25
0
 private void _OnLoginStatusUpdate(OscarSession sess, string messages, double percent)
 {
     Session.AddTextToChat(_NetworkChat, "-!- Login: " + messages);
 }
示例#26
0
文件: Main.cs 项目: pkt30/OscarLib
        private void sess_MasterGroupItemReceived(Session sess, int k)
        {
            for (int i = 0; i < k; ++i)
                groups.Add(new ContactListGroup());

            Console.WriteLine(String.Format("Expecting {0} groups", k));
        }
示例#27
0
文件: Main.cs 项目: pkt30/OscarLib
 private void sess_BuddyItemReceived(Session sess, SSIBuddy buddy)
 {
     //foreach (ContactListGroup clg in groups)
     //{
     //  if ((clg.group != null) && (clg.group.ID == buddy.GroupID))
     //  {
     //    for (int i = 0; i < clg.group.Children.GetLength(0); ++i)
     //    {
     //      if (clg.group.Children[i] == buddy.ID)
     //      {
     //        clg.buddies[i] = buddy;
     //      }
     //    }
     //  }
     //}
     Console.WriteLine(String.Format("Received Buddy({0}): {1}({2}) GroupId:{3}", buddy.ID, buddy.Name, buddy.DisplayName,buddy.GroupID));
 }
示例#28
0
文件: Main.cs 项目: pkt30/OscarLib
 private void sess_WarningMessage(Session sess, ServerErrorCode error)
 {
     Console.WriteLine("Warning: " + error);
 }
示例#29
0
文件: Main.cs 项目: pkt30/OscarLib
 private void sess_ChatInvitationReceived(Session sess, UserInfo sender, string roomname, string message,
                                          Encoding encoding, string language, Cookie key)
 {
     Console.WriteLine("Received chat invite from " + sender.ScreenName + " to " + roomname + ": " + message);
     Console.WriteLine("Auto-accepting");
     sess.ChatRooms.JoinChatRoom(key);
 }
示例#30
0
        public override void Connect(FrontendManager fm, string host, int port, string username, string password)
        {
            Trace.Call(fm, host, port, username, password);

            _FrontendManager = fm;
            Host = "login.oscar.aol.com";
            Port = 5190;

            // TODO: use config for single network chat or once per network manager
            _NetworkChat = new ProtocolChatModel(NetworkID, NetworkID + " Messenger", this);
            Session.AddChat(_NetworkChat);
            Session.SyncChat(_NetworkChat);

            _OscarSession = new OscarSession(username, password);
            _OscarSession.ClientCapabilities = Capabilities.Chat | Capabilities.OscarLib;
            _OscarSession.LoginCompleted           += new LoginCompletedHandler(_OnLoginCompleted);
            _OscarSession.LoginFailed              += new LoginFailedHandler(_OnLoginFailed);
            _OscarSession.LoginStatusUpdate        += new LoginStatusUpdateHandler(_OnLoginStatusUpdate);
            _OscarSession.ErrorMessage             += new ErrorMessageHandler(_OnErrorMessage);
            _OscarSession.WarningMessage           += new WarningMessageHandler(_OnWarningMessage);
            _OscarSession.StatusUpdate             += new InformationMessageHandler(_OnStatusUpdate);
            _OscarSession.ContactListFinished      += new ContactListFinishedHandler(_OnContactListFinished);
            _OscarSession.Messages.MessageReceived += new MessageReceivedHandler(_OnMessageReceived);
            _OscarSession.Logon(Host, Port);
        }
示例#31
0
文件: Main.cs 项目: pkt30/OscarLib
 private void sess_ContactListFinished(Session sess, DateTime dt)
 {
     Console.WriteLine();
     Console.WriteLine("Contact List Finished");
     //BuddyListDump();
     sess.ActivateBuddyList();
 }
示例#32
0
        private void _OnLoginCompleted(OscarSession sess)
        {
            IsConnected = true;

            string msg = _("Login successful");
            Session.AddTextToChat(_NetworkChat, "-!- " + msg);
        }
示例#33
0
文件: Main.cs 项目: pkt30/OscarLib
 private void sess_DirectIMReceived(Session sess, DirectIM message)
 {
     Console.WriteLine("DirectIM Message from {1}: {0}", message.Message, message.ScreenName);
     sess.Messages.SendMessage(message.ScreenName, "Your momma!", OutgoingMessageFlags.None);
 }
示例#34
0
 private void _OnLoginStatusUpdate(OscarSession sess, string messages, double percent)
 {
     Session.AddTextToChat(_NetworkChat, "-!- Login: " + messages);
 }
示例#35
0
文件: Main.cs 项目: pkt30/OscarLib
 private void sess_DirectIMRequestReceived(Session sess, UserInfo sender, string message, Cookie key)
 {
     Console.WriteLine("Auto-accepting DIM invite from {0} ({1})", sender.ScreenName, message);
     sess.AcceptDirectIMSession(key);
 }
示例#36
0
 private void _OnWarningMessage(OscarSession sess, ServerErrorCode errorCode)
 {
     string msg = String.Format(_("Connection Warning: {0}"), errorCode);
     Session.AddTextToChat(_NetworkChat, "-!- " + msg);
 }
示例#37
0
文件: Main.cs 项目: pkt30/OscarLib
 private void sess_ErrorMessage(Session sess, ServerErrorCode error)
 {
     Console.WriteLine("Error: " + error);
 }