1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added sent to chat sessions

This commit is contained in:
James Booth 2012-10-06 00:42:37 +01:00
parent 0139fb8b10
commit f3881db1f9
2 changed files with 20 additions and 0 deletions

View File

@ -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;
}

View File

@ -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