some lag fixes and begin work on jingle
This commit is contained in:
@@ -163,6 +163,7 @@ func switchToTab(jid string, w *gtk.Window) {
|
|||||||
photo := vcu.Photo
|
photo := vcu.Photo
|
||||||
go func() {
|
go func() {
|
||||||
new_im := getAvatar(u.From, photo)
|
new_im := getAvatar(u.From, photo)
|
||||||
|
|
||||||
glib.IdleAdd(func() {
|
glib.IdleAdd(func() {
|
||||||
userbox.Remove(default_av)
|
userbox.Remove(default_av)
|
||||||
userbox.Prepend(new_im)
|
userbox.Prepend(new_im)
|
||||||
|
|||||||
+2
-4
@@ -53,7 +53,6 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return gtk.NewLabel("Unsupported message.")
|
return gtk.NewLabel("Unsupported message.")
|
||||||
}
|
}
|
||||||
fmt.Println(m.Body)
|
|
||||||
|
|
||||||
readmarker := Marker{}
|
readmarker := Marker{}
|
||||||
ok = m.Get(&readmarker)
|
ok = m.Get(&readmarker)
|
||||||
@@ -93,6 +92,8 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
popover.SetParent(mainBox)
|
popover.SetParent(mainBox)
|
||||||
popover.SetHasArrow(false)
|
popover.SetHasArrow(false)
|
||||||
|
|
||||||
|
|
||||||
|
gesture.Connect("pressed", func(n_press, x, y int) {
|
||||||
rc_box := gtk.NewBox(gtk.OrientationVertical, 0)
|
rc_box := gtk.NewBox(gtk.OrientationVertical, 0)
|
||||||
|
|
||||||
reactions := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
reactions := gtk.NewBox(gtk.OrientationHorizontal, 0)
|
||||||
@@ -131,8 +132,6 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
rc_box.Append(quote)
|
rc_box.Append(quote)
|
||||||
|
|
||||||
popover.SetChild(rc_box)
|
popover.SetChild(rc_box)
|
||||||
|
|
||||||
gesture.Connect("pressed", func(n_press, x, y int) {
|
|
||||||
rect := gdk.NewRectangle(x, y, 1, 1)
|
rect := gdk.NewRectangle(x, y, 1, 1)
|
||||||
popover.SetPointingTo(&rect)
|
popover.SetPointingTo(&rect)
|
||||||
popover.Popup()
|
popover.Popup()
|
||||||
@@ -228,7 +227,6 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
|
|||||||
mainBox.Append(authorBox)
|
mainBox.Append(authorBox)
|
||||||
mainBox.Append(contentBox)
|
mainBox.Append(contentBox)
|
||||||
|
|
||||||
mainBox.Append(reactions)
|
|
||||||
|
|
||||||
oob := stanza.OOB{}
|
oob := stanza.OOB{}
|
||||||
ok = m.Get(&oob)
|
ok = m.Get(&oob)
|
||||||
|
|||||||
@@ -859,7 +859,7 @@ func activate(app *gtk.Application) {
|
|||||||
switchToTab(t, &window.Window)
|
switchToTab(t, &window.Window)
|
||||||
})
|
})
|
||||||
|
|
||||||
b.AddController(gesture1)
|
box.AddController(gesture1)
|
||||||
menu.Append(box)
|
menu.Append(box)
|
||||||
menu.Append(gtk.NewSeparator(gtk.OrientationHorizontal))
|
menu.Append(gtk.NewSeparator(gtk.OrientationHorizontal))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
// Very experimental implementation of XEP-0166: Jingle
|
||||||
|
// https://xmpp.org/extensions/xep-0166.html
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/xml"
|
||||||
|
"gosrc.io/xmpp/stanza"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Jingle struct {
|
||||||
|
XMLName xml.Name `xml:"urn:xmpp:jingle:1 jingle"`
|
||||||
|
Action string `xml:"action,attr"`
|
||||||
|
Initiator string `xml:"initiator,attr,omitempty"`
|
||||||
|
Responder string `xml:"responder,attr,omitempty"`
|
||||||
|
Sid string `xml:"sid,attr"`
|
||||||
|
Reason *JingleReason `xml:"reason,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type JingleReason struct {
|
||||||
|
XMLName xml.Name `xml:"reason"`
|
||||||
|
AlternativeSession *string `xml:"alternative-session,omitempty"`
|
||||||
|
Busy *string `xml:"busy,omitempty"`
|
||||||
|
Cancelled *string `xml:"cancelled,omitempty"`
|
||||||
|
Decline *string `xml:"decline,omitempty"`
|
||||||
|
FailedTransport *string `xml:"failed-transport,omitempty"`
|
||||||
|
GeneralError *string `xml:"general-error,omitempty"`
|
||||||
|
IncompatibleParameters *string `xml:"incompatible-parameters,omitempty"`
|
||||||
|
SecurityError *string `xml:"security-error,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type JingleContent struct {
|
||||||
|
XMLName xml.Name `xml:"content"`
|
||||||
|
Name string `xml:"name,attr"`
|
||||||
|
Creator string `xml:"creator,attr"`
|
||||||
|
Description JingleContentDescription `xml:"description"`
|
||||||
|
Transport JingleContentTransport `xml:"transport"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type JingleContentDescription struct {
|
||||||
|
XMLName xml.Name `xml:"urn:xmpp:jingle:apps:rtp:1 description"`
|
||||||
|
Media string `xml:"media,attr"`
|
||||||
|
Payloads []JingleContentDescriptionPayload `xml:"payload-type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type JingleContentDescriptionPayload struct {
|
||||||
|
XMLName xml.Name `xml:"payload-type"`
|
||||||
|
ID int `xml:"id,attr"`
|
||||||
|
Name string `xml:"name,attr"`
|
||||||
|
ClockRate int `xml:"clockrate,attr,omitempty"`
|
||||||
|
Channels int `xml:"channels,attr,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type JingleContentTransport struct {
|
||||||
|
XMLName xml.Name `xml:"urn:xmpp:jingle:transports:ice-udp:1 transport"`
|
||||||
|
Ufrag string `xml:"ufrag,attr"`
|
||||||
|
Pwd string `xml:"pwd,attr"`
|
||||||
|
Candidates []JingleContentTransportCandidate `xml:"candidate"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type JingleContentTransportCandidate struct {
|
||||||
|
XMLName xml.Name `xml:"candidate"`
|
||||||
|
ID string `xml:"id,attr"`
|
||||||
|
Component int `xml:"component,attr"`
|
||||||
|
Foundation string `xml:"foundation,attr"`
|
||||||
|
Generation int `xml:"generation,attr"`
|
||||||
|
IP string `xml:"ip,attr"`
|
||||||
|
Port int `xml:"port,attr"`
|
||||||
|
Priority int `xml:"priority,attr"`
|
||||||
|
Protocol string `xml:"protocol,attr"`
|
||||||
|
Type string `xml:"type,attr"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
stanza.TypeRegistry.MapExtension(stanza.PKTIQ, xml.Name{Space: "urn:xmpp:jingle:1", Local: "jingle"}, Jingle{})
|
||||||
|
}
|
||||||
+15
-15
@@ -10,21 +10,21 @@ import (
|
|||||||
|
|
||||||
type VCard struct {
|
type VCard struct {
|
||||||
XMLName xml.Name `xml:"vcard-temp vCard"`
|
XMLName xml.Name `xml:"vcard-temp vCard"`
|
||||||
FirstName string `xml:"FN"`
|
FirstName string `xml:"FN,omitempty"`
|
||||||
LastName string `xml:"N>FAMILY"`
|
LastName string `xml:"N>FAMILY,omitempty"`
|
||||||
GivenName string `xml:"N>GIVEN"`
|
GivenName string `xml:"N>GIVEN,omitempty"`
|
||||||
MiddleName string `xml:"N>MIDDLE"`
|
MiddleName string `xml:"N>MIDDLE,omitempty"`
|
||||||
Nickname string `xml:"NICKNAME"`
|
Nickname string `xml:"NICKNAME,omitempty"`
|
||||||
URI string `xml:"URL"`
|
URI string `xml:"URL,omitempty"`
|
||||||
Birthday string `xml:"BDAY"`
|
Birthday string `xml:"BDAY,omitempty"`
|
||||||
OrgName string `xml:"ORG>ORGNAME"`
|
OrgName string `xml:"ORG>ORGNAME,omitempty"`
|
||||||
OrgUnit string `xml:"ORG>ORGUNIT"`
|
OrgUnit string `xml:"ORG>ORGUNIT,omitempty"`
|
||||||
Title string `xml:"TITLE"`
|
Title string `xml:"TITLE,omitempty"`
|
||||||
Role string `xml:"ROLE"`
|
Role string `xml:"ROLE,omitempty"`
|
||||||
Description string `xml:"DESC"`
|
Description string `xml:"DESC,omitempty"`
|
||||||
Jid string `xml:"JABBERID"`
|
Jid string `xml:"JABBERID,omitempty"`
|
||||||
Photo Photo `xml:"PHOTO"`
|
Photo Photo `xml:"PHOTO,omitempty"`
|
||||||
Email string `xml:"EMAIL>USERID"`
|
Email string `xml:"EMAIL>USERID,omitempty"`
|
||||||
ResultSet *stanza.ResultSet `xml:"set,omitempty"`
|
ResultSet *stanza.ResultSet `xml:"set,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user