коммит произвёл
Christopher Speller
родитель
08e54ed824
Коммит
d23ca07133
@@ -432,6 +432,75 @@ func (s *hooksRPCServer) UserHasLeftTeam(args *Z_UserHasLeftTeamArgs, returns *Z
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
hookNameToId["UserWillLogIn"] = UserWillLogInId
|
||||
}
|
||||
|
||||
type Z_UserWillLogInArgs struct {
|
||||
A *Context
|
||||
B *model.User
|
||||
}
|
||||
|
||||
type Z_UserWillLogInReturns struct {
|
||||
A string
|
||||
}
|
||||
|
||||
func (g *hooksRPCClient) UserWillLogIn(c *Context, user *model.User) string {
|
||||
_args := &Z_UserWillLogInArgs{c, user}
|
||||
_returns := &Z_UserWillLogInReturns{}
|
||||
if g.implemented[UserWillLogInId] {
|
||||
if err := g.client.Call("Plugin.UserWillLogIn", _args, _returns); err != nil {
|
||||
g.log.Error("RPC call UserWillLogIn to plugin failed.", mlog.Err(err))
|
||||
}
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *hooksRPCServer) UserWillLogIn(args *Z_UserWillLogInArgs, returns *Z_UserWillLogInReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
UserWillLogIn(c *Context, user *model.User) string
|
||||
}); ok {
|
||||
returns.A = hook.UserWillLogIn(args.A, args.B)
|
||||
} else {
|
||||
return fmt.Errorf("Hook UserWillLogIn called but not implemented.")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
hookNameToId["UserHasLoggedIn"] = UserHasLoggedInId
|
||||
}
|
||||
|
||||
type Z_UserHasLoggedInArgs struct {
|
||||
A *Context
|
||||
B *model.User
|
||||
}
|
||||
|
||||
type Z_UserHasLoggedInReturns struct {
|
||||
}
|
||||
|
||||
func (g *hooksRPCClient) UserHasLoggedIn(c *Context, user *model.User) {
|
||||
_args := &Z_UserHasLoggedInArgs{c, user}
|
||||
_returns := &Z_UserHasLoggedInReturns{}
|
||||
if g.implemented[UserHasLoggedInId] {
|
||||
if err := g.client.Call("Plugin.UserHasLoggedIn", _args, _returns); err != nil {
|
||||
g.log.Error("RPC call UserHasLoggedIn to plugin failed.", mlog.Err(err))
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s *hooksRPCServer) UserHasLoggedIn(args *Z_UserHasLoggedInArgs, returns *Z_UserHasLoggedInReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
UserHasLoggedIn(c *Context, user *model.User)
|
||||
}); ok {
|
||||
hook.UserHasLoggedIn(args.A, args.B)
|
||||
} else {
|
||||
return fmt.Errorf("Hook UserHasLoggedIn called but not implemented.")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_RegisterCommandArgs struct {
|
||||
A *model.Command
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user