public void TerminateSession(string strSessionId, TerminateReason reason) { GoogleTalkLogic session = null; lock (SessionLock) { if (Sessions.ContainsKey(strSessionId) == true) { session = Sessions[strSessionId]; } } if (session != null) { session.TerminateSession(reason); } }
public void SendJingle(string strSessionId, GoogleSession sessioninfo) { /// Create a new session logic and send out the intial session create request /// GoogleTalkLogic session = null; lock (SessionLock) { if (Sessions.ContainsKey(strSessionId) == true) { session = Sessions[strSessionId]; } } if (session != null) { session.SendGoogleSession(sessioninfo); } }
public string InitiateNewSession(JID jidto, GoogleSession sessioninfo) { /// Create a new session logic and send out the intial session create request /// string strSessionId = Guid.NewGuid().ToString(); GoogleTalkLogic session = new GoogleTalkLogic(this.XMPPClient, strSessionId, this); sessioninfo.SID = strSessionId; lock (SessionLock) { Sessions.Add(strSessionId, session); } session.InitiateSession(sessioninfo, jidto); return(strSessionId); }
public override bool NewIQ(IQ iq) { if (iq is GoogleTalkIQ) //Our XMPPMessageFactory created a jingle message { /// See if this is a JINGLE message for our session /// GoogleTalkIQ jingleiq = iq as GoogleTalkIQ; string strSessionId = jingleiq.Session.SID; GoogleTalkLogic sessionlogic = null; lock (SessionLock) { if (Sessions.ContainsKey(strSessionId) == true) { sessionlogic = Sessions[strSessionId]; } } if (sessionlogic != null) { sessionlogic.NewJingleIQ(jingleiq); if (sessionlogic.IsCompleted == true) { RemoveSesion(strSessionId); } return(true); } if (jingleiq.Session.Action == GoogleSession.Initiate) { GoogleTalkLogic newrequestlogic = new GoogleTalkLogic(this.XMPPClient, strSessionId, this); lock (SessionLock) { Sessions.Add(jingleiq.Session.SID, newrequestlogic); } newrequestlogic.NewIncomingSessionRequest(jingleiq); if (newrequestlogic.IsCompleted == true) { RemoveSesion(strSessionId); } return(true); } } else { /// May be a simple response to one of our jingle objects, send the message to each one to see /// List <GoogleTalkLogic> sessions = new List <GoogleTalkLogic>(); lock (SessionLock) { foreach (string strSessionId in Sessions.Keys) { sessions.Add(Sessions[strSessionId]); } } foreach (GoogleTalkLogic session in sessions) { bool bHandled = session.NewIQ(iq); if (bHandled == true) { if (session.IsCompleted == true) { RemoveSesion(session.SessionId); } return(true); } } } return(false); }