|
|
|
@ -451,14 +451,23 @@ func main() {
|
|
|
|
|
if msg == "" {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
bareFrom := strings.Split(v.Remote, "/")[0]
|
|
|
|
|
var bareFrom string
|
|
|
|
|
switch v.Type {
|
|
|
|
|
case "chat":
|
|
|
|
|
bareFrom = strings.Split(v.Remote, "/")[0]
|
|
|
|
|
case "groupchat":
|
|
|
|
|
bareFrom = v.Remote
|
|
|
|
|
default:
|
|
|
|
|
bareFrom = strings.Split(v.Remote, "/")[0]
|
|
|
|
|
}
|
|
|
|
|
// Print any messages if no recipients are specified
|
|
|
|
|
if len(recipients) == 0 {
|
|
|
|
|
fmt.Println(t.In(tz).Format(time.RFC3339), "[OX]",
|
|
|
|
|
bareFrom+":", msg)
|
|
|
|
|
} else {
|
|
|
|
|
for _, recipient := range recipients {
|
|
|
|
|
if bareFrom == strings.ToLower(recipient.Jid) {
|
|
|
|
|
if strings.Split(v.Remote, "/")[0] ==
|
|
|
|
|
strings.ToLower(recipient.Jid) {
|
|
|
|
|
fmt.Println(t.In(tz).Format(time.RFC3339),
|
|
|
|
|
"[OX]", bareFrom+":", msg)
|
|
|
|
|
}
|
|
|
|
@ -474,13 +483,22 @@ func main() {
|
|
|
|
|
} else {
|
|
|
|
|
t = v.Stamp
|
|
|
|
|
}
|
|
|
|
|
bareFrom := strings.Split(v.Remote, "/")[0]
|
|
|
|
|
var bareFrom string
|
|
|
|
|
switch v.Type {
|
|
|
|
|
case "chat":
|
|
|
|
|
bareFrom = strings.Split(v.Remote, "/")[0]
|
|
|
|
|
case "groupchat":
|
|
|
|
|
bareFrom = v.Remote
|
|
|
|
|
default:
|
|
|
|
|
bareFrom = strings.Split(v.Remote, "/")[0]
|
|
|
|
|
}
|
|
|
|
|
// Print any messages if no recipients are specified
|
|
|
|
|
if len(recipients) == 0 {
|
|
|
|
|
fmt.Println(t.In(tz).Format(time.RFC3339), bareFrom+":", v.Text)
|
|
|
|
|
} else {
|
|
|
|
|
for _, recipient := range recipients {
|
|
|
|
|
if bareFrom == strings.ToLower(recipient.Jid) {
|
|
|
|
|
if strings.Split(v.Remote, "/")[0] ==
|
|
|
|
|
strings.ToLower(recipient.Jid) {
|
|
|
|
|
fmt.Println(t.In(tz).Format(time.RFC3339),
|
|
|
|
|
bareFrom+":", v.Text)
|
|
|
|
|
}
|
|
|
|
|