mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2: update portalinternal
This commit is contained in:
parent
49b1f240ed
commit
da4cbb554b
2 changed files with 66 additions and 5 deletions
|
|
@ -49,6 +49,10 @@ func (portal *PortalInternals) SendErrorStatus(ctx context.Context, evt *event.E
|
|||
(*Portal)(portal).sendErrorStatus(ctx, evt, err)
|
||||
}
|
||||
|
||||
func (portal *PortalInternals) CheckConfusableName(ctx context.Context, userID id.UserID, name string) bool {
|
||||
return (*Portal)(portal).checkConfusableName(ctx, userID, name)
|
||||
}
|
||||
|
||||
func (portal *PortalInternals) HandleMatrixEvent(sender *User, evt *event.Event) {
|
||||
(*Portal)(portal).handleMatrixEvent(sender, evt)
|
||||
}
|
||||
|
|
@ -89,6 +93,10 @@ func (portal *PortalInternals) HandleMatrixReaction(ctx context.Context, sender
|
|||
(*Portal)(portal).handleMatrixReaction(ctx, sender, evt)
|
||||
}
|
||||
|
||||
func (portal *PortalInternals) HandleMatrixMembership(ctx context.Context, sender *UserLogin, origSender *OrigSender, evt *event.Event) {
|
||||
(*Portal)(portal).handleMatrixMembership(ctx, sender, origSender, evt)
|
||||
}
|
||||
|
||||
func (portal *PortalInternals) HandleMatrixRedaction(ctx context.Context, sender *UserLogin, origSender *OrigSender, evt *event.Event) {
|
||||
(*Portal)(portal).handleMatrixRedaction(ctx, sender, origSender, evt)
|
||||
}
|
||||
|
|
@ -264,3 +272,43 @@ func (portal *PortalInternals) UnlockedDelete(ctx context.Context) error {
|
|||
func (portal *PortalInternals) UnlockedDeleteCache() {
|
||||
(*Portal)(portal).unlockedDeleteCache()
|
||||
}
|
||||
|
||||
func (portal *PortalInternals) DoForwardBackfill(ctx context.Context, source *UserLogin, lastMessage *database.Message) {
|
||||
(*Portal)(portal).doForwardBackfill(ctx, source, lastMessage)
|
||||
}
|
||||
|
||||
func (portal *PortalInternals) DoThreadBackfill(ctx context.Context, source *UserLogin, threadID networkid.MessageID) {
|
||||
(*Portal)(portal).doThreadBackfill(ctx, source, threadID)
|
||||
}
|
||||
|
||||
func (portal *PortalInternals) SendBackfill(ctx context.Context, source *UserLogin, messages []*BackfillMessage, forceForward, markRead, inThread bool) {
|
||||
(*Portal)(portal).sendBackfill(ctx, source, messages, forceForward, markRead, inThread)
|
||||
}
|
||||
|
||||
func (portal *PortalInternals) SendBatch(ctx context.Context, source *UserLogin, messages []*BackfillMessage, forceForward, markRead, allowNotification bool) {
|
||||
(*Portal)(portal).sendBatch(ctx, source, messages, forceForward, markRead, allowNotification)
|
||||
}
|
||||
|
||||
func (portal *PortalInternals) SendLegacyBackfill(ctx context.Context, source *UserLogin, messages []*BackfillMessage, markRead bool) {
|
||||
(*Portal)(portal).sendLegacyBackfill(ctx, source, messages, markRead)
|
||||
}
|
||||
|
||||
func (portal *PortalInternals) UnlockedReID(ctx context.Context, target networkid.PortalKey) error {
|
||||
return (*Portal)(portal).unlockedReID(ctx, target)
|
||||
}
|
||||
|
||||
func (portal *PortalInternals) CreateParentAndAddToSpace(ctx context.Context, source *UserLogin) {
|
||||
(*Portal)(portal).createParentAndAddToSpace(ctx, source)
|
||||
}
|
||||
|
||||
func (portal *PortalInternals) AddToParentSpaceAndSave(ctx context.Context, save bool) {
|
||||
(*Portal)(portal).addToParentSpaceAndSave(ctx, save)
|
||||
}
|
||||
|
||||
func (portal *PortalInternals) ToggleSpace(ctx context.Context, spaceID id.RoomID, canonical, remove bool) error {
|
||||
return (*Portal)(portal).toggleSpace(ctx, spaceID, canonical, remove)
|
||||
}
|
||||
|
||||
func (portal *PortalInternals) SetMXIDToExistingRoom(roomID id.RoomID) bool {
|
||||
return (*Portal)(portal).setMXIDToExistingRoom(roomID)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,19 +67,26 @@ func getTypeName(expr ast.Expr) string {
|
|||
}
|
||||
}
|
||||
|
||||
var write func(str string)
|
||||
var writef func(format string, args ...any)
|
||||
|
||||
func main() {
|
||||
fset := token.NewFileSet()
|
||||
f := exerrors.Must(parser.ParseFile(fset, "portal.go", nil, parser.SkipObjectResolution))
|
||||
fileNames := []string{"portal.go", "portalbackfill.go", "portalreid.go", "space.go", "matrixinvite.go"}
|
||||
files := make([]*ast.File, len(fileNames))
|
||||
for i, name := range fileNames {
|
||||
files[i] = exerrors.Must(parser.ParseFile(fset, name, nil, parser.SkipObjectResolution))
|
||||
}
|
||||
file := exerrors.Must(os.OpenFile("portalinternal.go", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644))
|
||||
write := func(str string) {
|
||||
write = func(str string) {
|
||||
exerrors.Must(file.WriteString(str))
|
||||
}
|
||||
writef := func(format string, args ...any) {
|
||||
writef = func(format string, args ...any) {
|
||||
exerrors.Must(fmt.Fprintf(file, format, args...))
|
||||
}
|
||||
write(header)
|
||||
write("import (\n")
|
||||
for _, i := range f.Imports {
|
||||
for _, i := range files[0].Imports {
|
||||
write("\t")
|
||||
if i.Name != nil {
|
||||
writef("%s ", i.Name.Name)
|
||||
|
|
@ -88,6 +95,13 @@ func main() {
|
|||
}
|
||||
write(")\n")
|
||||
write(postImportHeader)
|
||||
for _, f := range files {
|
||||
processFile(f)
|
||||
}
|
||||
exerrors.PanicIfNotNil(file.Close())
|
||||
}
|
||||
|
||||
func processFile(f *ast.File) {
|
||||
ast.Inspect(f, func(node ast.Node) (retVal bool) {
|
||||
retVal = true
|
||||
funcDecl, ok := node.(*ast.FuncDecl)
|
||||
|
|
@ -156,5 +170,4 @@ func main() {
|
|||
write(")\n}\n")
|
||||
return
|
||||
})
|
||||
exerrors.PanicIfNotNil(file.Close())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue