Skip to content

Commit

Permalink
Improve identifier resolution and Capabilities (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
trek-boldly-go authored Feb 20, 2024
1 parent 477ed7f commit 02ef509
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions imessage/bluebubbles/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ func init() {
func (bb *blueBubbles) Start(readyCallback func()) error {
bb.log.Trace().Msg("Start")

if err := bb.connectAndListen(); err != nil {
return err
}

// Preload some caches
bb.usingPrivateAPI = bb.isPrivateAPI()
bb.RefreshContactList()

if err := bb.connectAndListen(); err != nil {
return err
}

// Notify main this API is fully loaded
readyCallback()

Expand Down Expand Up @@ -1262,6 +1262,11 @@ func (bb *blueBubbles) ResolveIdentifier(address string) (string, error) {
return "", err
}

if identifierResponse.Data.Service == "" || identifierResponse.Data.Address == "" {
bb.log.Warn().Any("response", identifierResponse).Str("address", address).Msg("No results found for provided identifier. Assuming 'iMessage' service.")
return "iMessage;-;" + handle, nil
}

return identifierResponse.Data.Service + ";-;" + identifierResponse.Data.Address, nil
}

Expand Down Expand Up @@ -1741,13 +1746,13 @@ func (bb *blueBubbles) PostStartupSyncHook() {
func (bb *blueBubbles) Capabilities() imessage.ConnectorCapabilities {
return imessage.ConnectorCapabilities{
MessageSendResponses: true,
SendTapbacks: true,
SendReadReceipts: true,
SendTypingNotifications: true,
SendTapbacks: bb.usingPrivateAPI,
SendReadReceipts: bb.usingPrivateAPI,
SendTypingNotifications: bb.usingPrivateAPI,
SendCaptions: true,
BridgeState: false,
MessageStatusCheckpoints: false,
DeliveredStatus: true,
DeliveredStatus: bb.usingPrivateAPI,
ContactChatMerging: false,
RichLinks: false,
ChatBridgeResult: false,
Expand Down

0 comments on commit 02ef509

Please sign in to comment.