jingle/sessions.h
changeset 80 1c2ef2c5debe
parent 75 bd48c89b0a3d
child 81 8b6320ad470b
--- a/jingle/sessions.h	Fri Jul 30 00:03:48 2010 +0200
+++ b/jingle/sessions.h	Wed Aug 04 23:46:47 2010 +0200
@@ -7,20 +7,39 @@
 
 
 typedef enum {
-  JINGLE_SESSION_
-} JingleStatus;
-
-typedef enum {
   JINGLE_SESSION_STATE_ACTIVE,
   JINGLE_SESSION_STATE_PENDING,
   JINGLE_SESSION_STATE_ENDED,
 } SessionState;
 
+typedef enum {
+  /* A session that was initiated by some remote entity */
+  JINGLE_SESSION_INCOMING,
+
+  /* A session that we initiated (by sending a session-initiate) */
+  JINGLE_SESSION_OUTGOING
+} SessionOrigin;
+
 typedef struct {
-  JingleStatus status;
+  /* Random session identifier generated by the initator. */
   gchar *sid;
-  gchar *initiator;
+
+  /* We need to know who initiated the session ?
+   * us or a remote entity. */
+  SessionOrigin origin;
+
+  /* jid of the xmpp entity that initiated the session. */
   gchar *from;
+
+  /* jid of the xmpp entity that received the initiation request. */
+  gchar *to;
+
+  /* jid of the entity we send iq. point to "from" or "to" depending on
+   * who initiated the session. Basically a shortcut to avoid checking
+   * origin. Should not be freed when destroying a JingleSession. */
+  gchar *recipient;
+
+  /* A singly-linked list of content. */
   GSList *content;
 } JingleSession;
 
@@ -35,8 +54,8 @@
   JingleTransportFuncs *transfuncs;
 } SessionContent;
 
-JingleSession *session_new(const gchar *sid, const gchar *initiator,
-                           const gchar *from);
+JingleSession *session_new(const gchar *sid, const gchar *from,
+                           const gchar *to, SessionOrigin origin);
 JingleSession *session_new_from_jinglenode(JingleNode *jn);
 JingleSession *session_find_by_sid(const gchar *sid, const gchar *from);
 JingleSession *session_find(const JingleNode *jn);