diff options
author | xengineering <me@xengineering.eu> | 2022-08-21 10:51:25 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2022-08-21 10:51:25 +0200 |
commit | bd516ecdb218f4122acf077bef5a4dbde91653e5 (patch) | |
tree | c7698470ea9c945eb252e7abfeb46a021e852e8c /data.c | |
parent | effdc7d687caf331217b6fc20ba51cabf3c56f20 (diff) | |
download | limox-bd516ecdb218f4122acf077bef5a4dbde91653e5.tar limox-bd516ecdb218f4122acf077bef5a4dbde91653e5.tar.zst limox-bd516ecdb218f4122acf077bef5a4dbde91653e5.zip |
Implement GUI part of message sending
Diffstat (limited to 'data.c')
-rw-r--r-- | data.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -102,3 +102,28 @@ void data_add_incoming_message(const char* sender_jid, const char* content) { // received message so that future responses go to this ressource } + +void data_add_outgoing_message(const char* sender_jid, const char* content, + chat_t* chat) { + + // allocate and initialize message_t + message_t* msg = malloc(sizeof(message_t)); + msg->sender_jid = malloc(sizeof(char)*strlen(sender_jid)); + strcpy(msg->sender_jid, sender_jid); + msg->recipient_jid = malloc(sizeof(char)*strlen(chat->jid)); + strcpy(msg->recipient_jid, chat->jid); + msg->content = malloc(sizeof(char)*strlen(content)); + strcpy(msg->content, content); + msg->next = NULL; + + // find pointer to next message of chat and add this message + message_t* m; + for (m = chat->messages; m != NULL; m=m->next); + m = msg; + + // TODO send this message via XMPP + + // create GUI widget for this message + gui_add_message_widget(msg, chat); + +} |