diff options
-rw-r--r-- | data.c | 6 | ||||
-rw-r--r-- | data.h | 1 | ||||
-rw-r--r-- | gtk.c | 3 |
3 files changed, 8 insertions, 2 deletions
@@ -22,6 +22,8 @@ void data_add_roster_item(const char* jid, const char* subscription, // initialize chat chat->messages = NULL; + chat->jid = malloc(sizeof(char)*strlen(jid)); + strcpy(chat->jid, jid); gui_add_chat_widget(chat); // initialize roster item @@ -63,6 +65,7 @@ void data_add_roster_item(const char* jid, const char* subscription, void data_add_incoming_message(const char* sender_jid, const char* content) { + // TODO rework based on chat->jid // find correct chat chat_t* chat = NULL; roster_item_t* i; @@ -95,4 +98,7 @@ void data_add_incoming_message(const char* sender_jid, const char* content) { // append message to chat m = msg; + // TODO could be more correct to update chat->jid to full JID of just + // received message so that future responses go to this ressource + } @@ -17,6 +17,7 @@ typedef struct _message_t { } message_t; typedef struct _chat_t { + char* jid; message_t* messages; void* widget; } chat_t; @@ -71,11 +71,10 @@ void send_message(chat_t* chat) { chat_widget_t* chat_widget = (chat_widget_t*)chat->widget; // get recipient and message text - const char* recipient = "unknown@example.com"; // TODO implement this const char* text = gtk_editable_get_text(GTK_EDITABLE(chat_widget->entry)); // execute dummy XMPP send TODO - printf("Sending to %s:\n> %s\n", recipient, text); + printf("Sending to %s:\n> %s\n", chat->jid, text); //// add message content to the chat //GtkWidget* message = gtk_label_new(text); |