aboutsummaryrefslogtreecommitdiff
path: root/xmpp/handlers.go
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp/handlers.go')
-rw-r--r--xmpp/handlers.go19
1 files changed, 16 insertions, 3 deletions
diff --git a/xmpp/handlers.go b/xmpp/handlers.go
index 06bc02b..1222a93 100644
--- a/xmpp/handlers.go
+++ b/xmpp/handlers.go
@@ -260,7 +260,7 @@ func handleGetVcardIq(s xmpp.Sender, iq *stanza.IQ, typ byte) {
return
}
- var fn, photo, nickname, given, family, tel string
+ var fn, photo, nickname, given, family, tel, info string
if chat != nil {
fn = chat.Title
@@ -284,6 +284,7 @@ func handleGetVcardIq(s xmpp.Sender, iq *stanza.IQ, typ byte) {
log.Errorf("PHOTO: %#v", err.Error())
}
}
+ info = session.GetChatDescription(chat)
}
if user != nil {
nickname = user.Username
@@ -299,7 +300,7 @@ func handleGetVcardIq(s xmpp.Sender, iq *stanza.IQ, typ byte) {
Id: iq.Id,
Type: "result",
},
- Payload: makeVCardPayload(typ, iq.To, fn, photo, nickname, given, family, tel),
+ Payload: makeVCardPayload(typ, iq.To, fn, photo, nickname, given, family, tel, info),
}
log.Debugf("%#v", answer)
@@ -371,7 +372,7 @@ func toToID(to string) (int64, bool) {
return toID, true
}
-func makeVCardPayload(typ byte, id string, fn string, photo string, nickname string, given string, family string, tel string) stanza.IQPayload {
+func makeVCardPayload(typ byte, id, fn, photo, nickname, given, family, tel, info string) stanza.IQPayload {
if typ == TypeVCardTemp {
vcard := &extensions.IqVcardTemp{}
@@ -384,6 +385,7 @@ func makeVCardPayload(typ byte, id string, fn string, photo string, nickname str
vcard.N.Given.Text = given
vcard.N.Family.Text = family
vcard.Tel.Number.Text = tel
+ vcard.Desc.Text = info
return vcard
} else if typ == TypeVCard4 {
@@ -447,6 +449,17 @@ func makeVCardPayload(typ byte, id string, fn string, photo string, nickname str
},
})
}
+ if info != "" {
+ nodes = append(nodes, stanza.Node{
+ XMLName: xml.Name{Local: "note"},
+ Nodes: []stanza.Node{
+ stanza.Node{
+ XMLName: xml.Name{Local: "text"},
+ Content: info,
+ },
+ },
+ })
+ }
pubsub := &stanza.PubSubGeneric{
Items: &stanza.Items{