about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-10-06 00:42:37 +0100
committerJames Booth <boothj5@gmail.com>2012-10-06 00:42:37 +0100
commitf3881db1f9cd6effc2f6b1b97160f6f51b7ed067 (patch)
tree39531a0d48ffbb8d5edba1be4dec24532040a762
parent0139fb8b1012ea9f1ec1ac8de187cde7eb502a78 (diff)
downloadprofani-tty-f3881db1f9cd6effc2f6b1b97160f6f51b7ed067.tar.gz
Added sent to chat sessions
-rw-r--r--src/chat_session.c16
-rw-r--r--src/chat_session.h4
2 files changed, 20 insertions, 0 deletions
diff --git a/src/chat_session.c b/src/chat_session.c
index 98628ab5..ff51b29d 100644
--- a/src/chat_session.c
+++ b/src/chat_session.c
@@ -33,6 +33,7 @@ static void _chat_session_free(ChatSession session);
 struct chat_session_t {
     char *recipient;
     chat_state_t state;
+    gboolean sent;
 };
 
 static GHashTable *sessions;
@@ -75,6 +76,20 @@ chat_session_set_state(char *recipient, chat_state_t state)
     session->state = state;
 }
 
+gboolean
+chat_session_get_sent(char *recipient)
+{
+    ChatSession session = g_hash_table_lookup(sessions, recipient);
+    return session->sent;
+}
+
+void
+chat_session_sent(char *recipient)
+{
+    ChatSession session = g_hash_table_lookup(sessions, recipient);
+    session->sent = TRUE;
+}
+
 static ChatSession
 _chat_session_new(char *recipient)
 {
@@ -82,6 +97,7 @@ _chat_session_new(char *recipient)
     new_session->recipient = malloc(strlen(recipient) + 1);
     strcpy(new_session->recipient, recipient);
     new_session->state = ACTIVE;
+    new_session->sent = FALSE;
     
     return new_session;
 }
diff --git a/src/chat_session.h b/src/chat_session.h
index 6b585a02..8c0d9048 100644
--- a/src/chat_session.h
+++ b/src/chat_session.h
@@ -23,6 +23,8 @@
 #ifndef CHAT_SESSION_H
 #define CHAT_SESSION_H
 
+#include <glib.h>
+
 typedef struct chat_session_t *ChatSession;
 
 typedef enum {
@@ -39,5 +41,7 @@ void chat_session_start(char *recipient);
 void chat_session_end(char *recipient);
 chat_state_t chat_session_get_state(char *recipient);
 void chat_session_set_state(char *recipient, chat_state_t state);
+gboolean chat_session_get_sent(char *recipient);
+void chat_session_sent(char *recipient);
 
 #endif