Skip to content

Commit

Permalink
Various changes inspired by working on purple-presage.
Browse files Browse the repository at this point in the history
Most of them related to groups. Also many TODOs.
hoehermann committed Jul 25, 2024
1 parent 77df460 commit bda223a
Showing 7 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@ Standard features:

* Connecting to existing account via QR-code.
* Receiving messages, sending messages.
* Receiving files (images, videos, voice, document, stickers).
* Receiving files (image, video and note, audio and voice, document, sticker).
* Received images are displayed in the conversation window (optional).
* Sending images as image messages.
* Sending JPEG images as image messages.
* Sending opus audio files as voice messages.
* Sending mp4 video files as video messages.
* Sending other files as documents.
1 change: 1 addition & 0 deletions src/c/blist.c
Original file line number Diff line number Diff line change
@@ -50,6 +50,7 @@ void gowhatsapp_ensure_buddy_in_blist(
gowhatsapp_assume_buddy_online(account, buddy);

// update name after checking against local alias and persisted name
// TODO: merge changes from purple-presage
const char *local_alias = purple_buddy_get_alias(buddy);
const char *server_alias = purple_blist_node_get_string(&buddy->node, "server_alias");
if (display_name != NULL && !purple_strequal(local_alias, display_name) && !purple_strequal(server_alias, display_name)) {
6 changes: 2 additions & 4 deletions src/c/display_message.c
Original file line number Diff line number Diff line change
@@ -53,10 +53,8 @@ void gowhatsapp_display_message_common(
}

if (isGroup) {
PurpleConversation *conv = gowhatsapp_enter_group_chat(pc, remoteJid, NULL);
if (conv != NULL) {
purple_serv_got_chat_in(pc, g_str_hash(remoteJid), senderJid, flags, text, timestamp);
}
gowhatsapp_enter_group_chat(pc, remoteJid, NULL);
purple_serv_got_chat_in(pc, g_str_hash(remoteJid), senderJid, flags, text, timestamp);
} else {
if (flags & PURPLE_MESSAGE_SEND) {
// display message sent from own account (other device as well as local echo)
2 changes: 1 addition & 1 deletion src/c/groups.c
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ gowhatsapp_roomlist_get_list(PurpleConnection *pc) {
g_return_val_if_fail(wpd != NULL, NULL);
PurpleRoomlist *roomlist = wpd->roomlist;
if (roomlist != NULL) {
purple_debug_info(GOWHATSAPP_NAME, "Already getting roomlist.");
purple_debug_info(GOWHATSAPP_NAME, "Already getting roomlist.\n");
return roomlist;
}
roomlist = purple_roomlist_new(account); // MEMCHECK: caller takes ownership
2 changes: 1 addition & 1 deletion src/c/process_message.c
Original file line number Diff line number Diff line change
@@ -121,7 +121,7 @@ gowhatsapp_process_message(gowhatsapp_message_t *gwamsg)
gowhatsapp_handle_group(pc, gwamsg);
break;
default:
purple_debug_info(GOWHATSAPP_NAME, "handling this message type is not implemented");
purple_debug_info(GOWHATSAPP_NAME, "Handling this message type is not implemented.\n");
g_free(gwamsg->blob);
}
}
1 change: 1 addition & 0 deletions src/go/bridge.go
Original file line number Diff line number Diff line change
@@ -163,6 +163,7 @@ func gowhatsapp_go_query_group_participants(account *PurpleAccount, groupid *C.c
if groupid != nil {
go_groupid := C.GoString(groupid)
jid, err := parseJID(go_groupid)
// TODO: check that jid actually is a group jid, see https://github.com/hoehermann/purple-gowhatsapp/issues/195
if err == nil {
return participants_to_ntcstrarray(handler.query_group_participants_retry(jid, 1, 10, 0))
} else {
2 changes: 1 addition & 1 deletion src/go/send_file.go
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ import (

// based on https://github.com/tulir/whatsmeow/blob/main/mdtest/main.go
func (handler *Handler) send_file(who string, filename string) string {
isGroup := false // can only send to single contacts for now
isGroup := false // TODO: there is a gowhatsapp_chat_send_file, respect the group chat.
recipient, err := parseJID(who)
if err != nil {
return fmt.Sprintf("%#v", err)

0 comments on commit bda223a

Please sign in to comment.