@@ -35,24 +35,24 @@ var phoneNumberRegex = regexp.MustCompile(`[^0-9]`)
3535
3636// WhatsAppService implements Service using the Whatsmeow-based whatsapp client.
3737type WhatsAppService struct {
38- client whatsapp.WhatsAppSender
39- waClient * whatsapp.Client // Access to underlying client for event handling
40- receipts chan models.Receipt
41- responses chan models.Response
42- done chan struct {}
43- mu sync.RWMutex
44- stopped bool
45- lidMu sync.RWMutex
38+ client whatsapp.WhatsAppSender
39+ waClient * whatsapp.Client // Access to underlying client for event handling
40+ receipts chan models.Receipt
41+ responses chan models.Response
42+ done chan struct {}
43+ mu sync.RWMutex
44+ stopped bool
45+ lidMu sync.RWMutex
4646 lidByPhone map [string ]string // canonical phone -> JID string for LID addressing
4747}
4848
4949// NewWhatsAppService creates a new WhatsAppService wrapping the given WhatsAppSender.
5050func NewWhatsAppService (client whatsapp.WhatsAppSender ) * WhatsAppService {
5151 service := & WhatsAppService {
52- client : client ,
53- receipts : make (chan models.Receipt , DefaultChannelBufferSize ),
54- responses : make (chan models.Response , DefaultChannelBufferSize ),
55- done : make (chan struct {}),
52+ client : client ,
53+ receipts : make (chan models.Receipt , DefaultChannelBufferSize ),
54+ responses : make (chan models.Response , DefaultChannelBufferSize ),
55+ done : make (chan struct {}),
5656 lidByPhone : make (map [string ]string ),
5757 }
5858
@@ -423,7 +423,7 @@ func (s *WhatsAppService) handleIncomingMessage(evt *events.Message) {
423423 lidJID = senderAlt
424424 }
425425
426- if phoneJID .User == "" || phoneJID .Server != types .DefaultUserServer {
426+ if phoneJID .User == "" || ( phoneJID .Server != types .DefaultUserServer && phoneJID . Server != types . LegacyUserServer ) {
427427 phoneJID = sender
428428 }
429429
0 commit comments