some lag fixes and begin work on jingle

This commit is contained in:
2026-05-07 09:16:38 +01:00
parent 82aa2abfbd
commit 9593e7c041
5 changed files with 95 additions and 20 deletions
+1
View File
@@ -163,6 +163,7 @@ func switchToTab(jid string, w *gtk.Window) {
photo := vcu.Photo
go func() {
new_im := getAvatar(u.From, photo)
glib.IdleAdd(func() {
userbox.Remove(default_av)
userbox.Prepend(new_im)
+2 -4
View File
@@ -53,7 +53,6 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
if !ok {
return gtk.NewLabel("Unsupported message.")
}
fmt.Println(m.Body)
readmarker := Marker{}
ok = m.Get(&readmarker)
@@ -93,6 +92,8 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
popover.SetParent(mainBox)
popover.SetHasArrow(false)
gesture.Connect("pressed", func(n_press, x, y int) {
rc_box := gtk.NewBox(gtk.OrientationVertical, 0)
reactions := gtk.NewBox(gtk.OrientationHorizontal, 0)
@@ -131,8 +132,6 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
rc_box.Append(quote)
popover.SetChild(rc_box)
gesture.Connect("pressed", func(n_press, x, y int) {
rect := gdk.NewRectangle(x, y, 1, 1)
popover.SetPointingTo(&rect)
popover.Popup()
@@ -228,7 +227,6 @@ func generateMessageWidget(p stanza.Packet) gtk.Widgetter {
mainBox.Append(authorBox)
mainBox.Append(contentBox)
mainBox.Append(reactions)
oob := stanza.OOB{}
ok = m.Get(&oob)
+1 -1
View File
@@ -859,7 +859,7 @@ func activate(app *gtk.Application) {
switchToTab(t, &window.Window)
})
b.AddController(gesture1)
box.AddController(gesture1)
menu.Append(box)
menu.Append(gtk.NewSeparator(gtk.OrientationHorizontal))
}
+76
View File
@@ -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
View File
@@ -10,21 +10,21 @@ import (
type VCard struct {
XMLName xml.Name `xml:"vcard-temp vCard"`
FirstName string `xml:"FN"`
LastName string `xml:"N>FAMILY"`
GivenName string `xml:"N>GIVEN"`
MiddleName string `xml:"N>MIDDLE"`
Nickname string `xml:"NICKNAME"`
URI string `xml:"URL"`
Birthday string `xml:"BDAY"`
OrgName string `xml:"ORG>ORGNAME"`
OrgUnit string `xml:"ORG>ORGUNIT"`
Title string `xml:"TITLE"`
Role string `xml:"ROLE"`
Description string `xml:"DESC"`
Jid string `xml:"JABBERID"`
Photo Photo `xml:"PHOTO"`
Email string `xml:"EMAIL>USERID"`
FirstName string `xml:"FN,omitempty"`
LastName string `xml:"N>FAMILY,omitempty"`
GivenName string `xml:"N>GIVEN,omitempty"`
MiddleName string `xml:"N>MIDDLE,omitempty"`
Nickname string `xml:"NICKNAME,omitempty"`
URI string `xml:"URL,omitempty"`
Birthday string `xml:"BDAY,omitempty"`
OrgName string `xml:"ORG>ORGNAME,omitempty"`
OrgUnit string `xml:"ORG>ORGUNIT,omitempty"`
Title string `xml:"TITLE,omitempty"`
Role string `xml:"ROLE,omitempty"`
Description string `xml:"DESC,omitempty"`
Jid string `xml:"JABBERID,omitempty"`
Photo Photo `xml:"PHOTO,omitempty"`
Email string `xml:"EMAIL>USERID,omitempty"`
ResultSet *stanza.ResultSet `xml:"set,omitempty"`
}