mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-31 16:06:22 +00:00
Added sent to chat sessions
This commit is contained in:
@@ -33,6 +33,7 @@ static void _chat_session_free(ChatSession session);
|
|||||||
struct chat_session_t {
|
struct chat_session_t {
|
||||||
char *recipient;
|
char *recipient;
|
||||||
chat_state_t state;
|
chat_state_t state;
|
||||||
|
gboolean sent;
|
||||||
};
|
};
|
||||||
|
|
||||||
static GHashTable *sessions;
|
static GHashTable *sessions;
|
||||||
@@ -75,6 +76,20 @@ chat_session_set_state(char *recipient, chat_state_t state)
|
|||||||
session->state = 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
|
static ChatSession
|
||||||
_chat_session_new(char *recipient)
|
_chat_session_new(char *recipient)
|
||||||
{
|
{
|
||||||
@@ -82,6 +97,7 @@ _chat_session_new(char *recipient)
|
|||||||
new_session->recipient = malloc(strlen(recipient) + 1);
|
new_session->recipient = malloc(strlen(recipient) + 1);
|
||||||
strcpy(new_session->recipient, recipient);
|
strcpy(new_session->recipient, recipient);
|
||||||
new_session->state = ACTIVE;
|
new_session->state = ACTIVE;
|
||||||
|
new_session->sent = FALSE;
|
||||||
|
|
||||||
return new_session;
|
return new_session;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
#ifndef CHAT_SESSION_H
|
#ifndef CHAT_SESSION_H
|
||||||
#define CHAT_SESSION_H
|
#define CHAT_SESSION_H
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
typedef struct chat_session_t *ChatSession;
|
typedef struct chat_session_t *ChatSession;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -39,5 +41,7 @@ void chat_session_start(char *recipient);
|
|||||||
void chat_session_end(char *recipient);
|
void chat_session_end(char *recipient);
|
||||||
chat_state_t chat_session_get_state(char *recipient);
|
chat_state_t chat_session_get_state(char *recipient);
|
||||||
void chat_session_set_state(char *recipient, chat_state_t state);
|
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
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user