Skip to content

Commit 7c9a6ec

Browse files
committed
Update protobuf definitions and capitalize parameter names
- Updated protobuf definitions to align with the latest protocol specifications. - Capitalized parameter names for consistency and readability in the Python bindings. - Minor improvements to documentation and code comments.
1 parent aeb297a commit 7c9a6ec

File tree

23 files changed

+212
-15050
lines changed

23 files changed

+212
-15050
lines changed

get_proto.sh

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
git clone --depth 1 https://github.com/tulir/whatsmeow.git
2-
rm -rf goneonize/proto/waproto
3-
mv whatsmeow/proto goneonize/waproto
4-
rm goneonize/waproto/proto/*/*.pb.*
5-
rm -rf whatsmeow
2+
rm -rf goneonize/defproto
3+
mv whatsmeow/proto goneonize/defproto
4+
rm goneonize/defproto/*/*.pb.*
5+
rm goneonize/defproto/*/*.go
6+
rm goneonize/defproto/.gitignore
7+
rm goneonize/defproto/*.*
8+
rm -rf whatsmeow
9+
cp goneonize/Neonize.proto goneonize/defproto

goneonize/contact_store.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ package main
33
import (
44
"C"
55

6-
"github.com/krypton-byte/neonize/neonize"
6+
"github.com/krypton-byte/neonize/defproto"
77
"github.com/krypton-byte/neonize/utils"
88
"google.golang.org/protobuf/proto"
99
)
1010
import "go.mau.fi/whatsmeow/store"
1111

1212
//export PutPushName
1313
func PutPushName(id *C.char, user *C.uchar, userSize C.int, pushname *C.char) C.struct_BytesReturn {
14-
var userJID neonize.JID
14+
var userJID defproto.JID
1515
err := proto.Unmarshal(getByteByAddr(user, userSize), &userJID)
1616
if err != nil {
1717
panic(err)
1818
}
19-
return_ := neonize.ContactsPutPushNameReturnFunction{}
19+
return_ := defproto.ContactsPutPushNameReturnFunction{}
2020
status, prev_name, err := clients[C.GoString(id)].Store.Contacts.PutPushName(utils.DecodeJidProto(&userJID), C.GoString(pushname))
2121
return_.PreviousName = proto.String(prev_name)
2222
return_.Status = &status
@@ -32,12 +32,12 @@ func PutPushName(id *C.char, user *C.uchar, userSize C.int, pushname *C.char) C.
3232

3333
//export PutBusinessName
3434
func PutBusinessName(id *C.char, user *C.uchar, userSize C.int, businessName *C.char) C.struct_BytesReturn {
35-
var userJID neonize.JID
35+
var userJID defproto.JID
3636
err := proto.Unmarshal(getByteByAddr(user, userSize), &userJID)
3737
if err != nil {
3838
panic(err)
3939
}
40-
return_ := neonize.ContactsPutPushNameReturnFunction{}
40+
return_ := defproto.ContactsPutPushNameReturnFunction{}
4141
status, prev_name, err := clients[C.GoString(id)].Store.Contacts.PutBusinessName(utils.DecodeJidProto(&userJID), C.GoString(businessName))
4242
return_.PreviousName = proto.String(prev_name)
4343
return_.Status = &status
@@ -53,7 +53,7 @@ func PutBusinessName(id *C.char, user *C.uchar, userSize C.int, businessName *C.
5353

5454
//export PutContactName
5555
func PutContactName(id *C.char, user *C.uchar, userSize C.int, fullName, firstName *C.char) *C.char {
56-
var userJID neonize.JID
56+
var userJID defproto.JID
5757
err := proto.Unmarshal(getByteByAddr(user, userSize), &userJID)
5858
if err != nil {
5959
panic(err)
@@ -67,7 +67,7 @@ func PutContactName(id *C.char, user *C.uchar, userSize C.int, fullName, firstNa
6767

6868
//export PutAllContactNames
6969
func PutAllContactNames(id *C.char, contacts *C.uchar, contactsSize C.int) *C.char {
70-
var entry neonize.ContactEntryArray
70+
var entry defproto.ContactEntryArray
7171
err := proto.Unmarshal(getByteByAddr(contacts, contactsSize), &entry)
7272
if err != nil {
7373
panic(err)
@@ -85,13 +85,13 @@ func PutAllContactNames(id *C.char, contacts *C.uchar, contactsSize C.int) *C.ch
8585

8686
//export GetContact
8787
func GetContact(id *C.char, user *C.uchar, userSize C.int) C.struct_BytesReturn {
88-
var userJID neonize.JID
88+
var userJID defproto.JID
8989
err := proto.Unmarshal(getByteByAddr(user, userSize), &userJID)
9090
if err != nil {
9191
panic(err)
9292
}
9393
contact_info, err_ := clients[C.GoString(id)].Store.Contacts.GetContact(utils.DecodeJidProto(&userJID))
94-
return_ := neonize.ContactsGetContactReturnFunction{
94+
return_ := defproto.ContactsGetContactReturnFunction{
9595
ContactInfo: utils.EncodeContactInfo(contact_info),
9696
}
9797
if err_ != nil {
@@ -107,7 +107,7 @@ func GetContact(id *C.char, user *C.uchar, userSize C.int) C.struct_BytesReturn
107107
//export GetAllContacts
108108
func GetAllContacts(id *C.char) C.struct_BytesReturn {
109109
contacts, err := clients[C.GoString(id)].Store.Contacts.GetAllContacts()
110-
return_ := neonize.ContactsGetAllContactsReturnFunction{
110+
return_ := defproto.ContactsGetAllContactsReturnFunction{
111111
Contact: utils.EncodeContacts(contacts),
112112
}
113113
if err != nil {

0 commit comments

Comments
 (0)