minor cleanup

This commit is contained in:
Karmanyaah Malhotra 2021-03-05 18:59:06 -05:00
parent 1636f92acd
commit 7d6847fd3b
5 changed files with 9 additions and 5 deletions

View File

@ -874,7 +874,7 @@ func (handler *CommandHandler) CommandOpen(ce *CommandEvent) {
ce.Reply("Group JID not found in contacts. Try syncing contacts with `sync` first.") ce.Reply("Group JID not found in contacts. Try syncing contacts with `sync` first.")
return return
} }
handler.log.Debugln("Importing", jid, "for", user) handler.log.Debugln("Importing", jid, "for", user.MXID)
portal := user.bridge.GetPortalByJID(database.GroupPortalKey(jid)) portal := user.bridge.GetPortalByJID(database.GroupPortalKey(jid))
if len(portal.MXID) > 0 { if len(portal.MXID) > 0 {
portal.Sync(user, contact) portal.Sync(user, contact)

View File

@ -198,7 +198,6 @@ func (store *SQLStateStore) SetMembership(roomID id.RoomID, userID id.UserID, me
Membership: string(membership), Membership: string(membership),
} }
print("weird thing 2 502650285") print("weird thing 2 502650285")
print(user.Membership)
ans := store.db.Clauses(clause.OnConflict{ ans := store.db.Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "room_id"}, {Name: "user_id"}}, Columns: []clause.Column{{Name: "room_id"}, {Name: "user_id"}},

3
go.mod
View File

@ -7,7 +7,6 @@ require (
github.com/gorilla/websocket v1.4.2 github.com/gorilla/websocket v1.4.2
github.com/jackc/pgproto3/v2 v2.0.7 // indirect github.com/jackc/pgproto3/v2 v2.0.7 // indirect
github.com/karmanyaahm/groupme v0.2.0 github.com/karmanyaahm/groupme v0.2.0
github.com/karmanyaahm/wray v0.0.0-20210129044305-8ca7d2cc2388 // indirect
github.com/lib/pq v1.9.0 github.com/lib/pq v1.9.0
github.com/mattn/go-sqlite3 v1.14.6 github.com/mattn/go-sqlite3 v1.14.6
github.com/prometheus/client_golang v1.9.0 github.com/prometheus/client_golang v1.9.0
@ -29,3 +28,5 @@ require (
) )
replace github.com/karmanyaahm/groupme => ../groupme replace github.com/karmanyaahm/groupme => ../groupme
replace github.com/karmanyaahm/wray => ../wray

View File

@ -2,7 +2,6 @@ package groupmeExt
import ( import (
"context" "context"
"fmt"
"github.com/karmanyaahm/groupme" "github.com/karmanyaahm/groupme"
"github.com/karmanyaahm/matrix-groupme-go/types" "github.com/karmanyaahm/matrix-groupme-go/types"
@ -45,7 +44,7 @@ func (c Client) LoadMessagesBefore(groupID, lastMessageID string, num int) ([]*g
BeforeID: groupme.ID(lastMessageID), BeforeID: groupme.ID(lastMessageID),
Limit: num, Limit: num,
}) })
fmt.Println(groupID, lastMessageID, num, i.Count, e) //fmt.Println(groupID, lastMessageID, num, i.Count, e)
if e != nil { if e != nil {
return nil, e return nil, e
} }

View File

@ -587,6 +587,11 @@ func (portal *Portal) Sync(user *User, group groupme.Group) {
portal.hasRelaybot = &yes portal.hasRelaybot = &yes
} }
err := user.Conn.SubscribeToGroup(context.TODO(), group.ID, user.Token)
if err != nil {
portal.log.Errorln("Subscribing failed, live metadata updates won't work", err)
}
if len(portal.MXID) == 0 { if len(portal.MXID) == 0 {
if !portal.IsPrivateChat() { if !portal.IsPrivateChat() {
portal.Name = group.Name portal.Name = group.Name