public MessagingManager(	AuthInfo authInfo,
									EmailServiceDescription emailServiceDescription,
									OpenPGPRing openPgpRing,
									XmppServiceDescription xmppServiceDescription,
									OTRKeyRing otrKeyring,
									ContactManager contactManager,
									Logger logger,
									int inboxCheckIntervall,
									bool isInMinutes)
        {
            m_AuthInfo = authInfo;
            m_EmailServiceDescription = emailServiceDescription;
            m_OpenPgpRing = openPgpRing;
            m_XmppServiceDescription = xmppServiceDescription;
            m_OtrKeyRing = otrKeyring;
            m_Logger = logger;
            m_InboxCheckIntervall = inboxCheckIntervall;
            m_bIsIntervallInMinutes = isInMinutes;
            m_ConversationManager = new ConversationManager ();
            m_ContactManager = contactManager;

            RC rcMail = initEmailManager();
            RC rcXmpp = initXmppManager();
            m_Status = RC.RC_OK;
            if (rcMail != RC.RC_OK) {
                m_Status = RC.RC_COULD_NOT_INIT_EMAIL;
            }

            if (rcXmpp != RC.RC_OK) {
                m_Status = RC.RC_COULD_NOT_INIT_XMPP;
            }
        }
示例#2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sJid">S jid.</param>
        /// <param name="sPassword">S password.</param>
        public XmppManager(AuthInfo authInfo, XmppServiceDescription xmppServiceDescription, OTRKeyRing _OTRKeyRing, OpenPGPRing _OpenPGPRing, ConversationManager _conversationManager, ContactManager _contactMgr, Logger _logger)
        {
            try
            {
                m_Logger = _logger;
                m_OTRKeyRing = _OTRKeyRing;
                m_OpenPGPRing = _OpenPGPRing;
                m_AuthInfo = authInfo;
                m_XmppServiceDescription = xmppServiceDescription;
                m_JidSender = new Jid (m_AuthInfo.m_sId);
                m_ClientConnection = new XmppClientConnection(m_JidSender.Server);
                m_Contacts = new Dictionary<string, string> ();
                m_ContactPresence = new Dictionary<string, Presence> ();
                m_Logger.log(ELogLevel.LVL_INFO, "Trying to log in xmpp user", m_sModuleName);
                m_ClientConnection.Open(m_JidSender.User, m_AuthInfo.m_sPassword);
                m_ConversationManager = _conversationManager;
                m_ContactManager = _contactMgr;
                m_OtrConnections = new Dictionary<string, int>();

                //register EventHandlers
                m_ClientConnection.OnLogin += new ObjectHandler(onLogin);
                m_ClientConnection.OnPresence += new PresenceHandler(OnPresence);
            }
            catch(Exception e) {
                Console.Write (e.Message);
            }

            //info: message callback is registered in onRosterItem callback
        }