diff options
author | James Booth <boothj5@gmail.com> | 2012-10-06 00:42:37 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-10-06 00:42:37 +0100 |
commit | f3881db1f9cd6effc2f6b1b97160f6f51b7ed067 (patch) | |
tree | 39531a0d48ffbb8d5edba1be4dec24532040a762 /src | |
parent | 0139fb8b1012ea9f1ec1ac8de187cde7eb502a78 (diff) | |
download | profani-tty-f3881db1f9cd6effc2f6b1b97160f6f51b7ed067.tar.gz |
Added sent to chat sessions
Diffstat (limited to 'src')
-rw-r--r-- | src/chat_session.c | 16 | ||||
-rw-r--r-- | src/chat_session.h | 4 |
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 |