Beispiel #1
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, AddressBook _addressBook, Logger _logger)
        {
            try
            {
                m_Logger = _logger;
                m_OTRKeyRing = _OTRKeyRing;
                m_OpenPGPRing = _OpenPGPRing;
                m_AuthInfo = authInfo;
                m_OwnJid = new Jid (m_AuthInfo.m_sId);
                m_ClientConnection = new XmppClientConnection(m_OwnJid.Server);
                m_Contacts = new Dictionary<string, string> ();
                m_Logger.log(ELogLevel.LVL_INFO, "Trying to log in xmpp user", m_sModuleName);
                m_ClientConnection.Open(m_OwnJid.User, m_AuthInfo.m_sPassword);
                m_ConversationManager = _conversationManager;
                m_AddressBook = _addressBook;
                m_PresenceManager = new PresenceManager(m_AddressBook);
                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
        }
        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;
            }
        }