// Factory creates a new session from the given config func Factory(c *config.ApplicationConfig, cu *config.Account, df func(tls.Verifier) xi.Dialer) access.Session { // Make xmppLogger go to in memory STRING and/or the log file inMemoryLog, xmppLogger := createXMPPLogger(c.RawLogFile) s := &session{ config: c, accountConfig: cu, r: roster.New(), otrEventHandler: make(map[string]*event.OtrEventHandler), lastActionTime: time.Now(), timeouts: make(map[data.Cookie]time.Time), autoApproves: make(map[string]bool), inMemoryLog: inMemoryLog, xmppLogger: xmppLogger, connectionLogger: logToDebugLog(), dialerFactory: df, } s.ReloadKeys() s.convManager = client.NewConversationManager(s, s) go observe(s) go checkReconnect(s) return s }
// NewSession creates a new session from the given config func NewSession(c *config.ApplicationConfig, cu *config.Account) *Session { s := &Session{ Config: c, accountConfig: cu, R: roster.New(), OtrEventHandler: make(map[string]*event.OtrEventHandler), LastActionTime: time.Now(), timeouts: make(map[xmpp.Cookie]time.Time), xmppLogger: openLogFile(c.RawLogFile), } s.PrivateKeys = parseFromConfig(cu) s.ConversationManager = client.NewConversationManager(s, s) go observe(s) return s }
// Factory creates a new session from the given config func Factory(c *config.ApplicationConfig, cu *config.Account) access.Session { s := &session{ config: c, accountConfig: cu, r: roster.New(), otrEventHandler: make(map[string]*event.OtrEventHandler), lastActionTime: time.Now(), timeouts: make(map[xmpp.Cookie]time.Time), xmppLogger: openLogFile(c.RawLogFile), } s.ReloadKeys() s.convManager = client.NewConversationManager(s, s) go observe(s) go checkReconnect(s) return s }