github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/service/notify.go (about)

     1  // Copyright 2015 Keybase, Inc. All rights reserved. Use of
     2  // this source code is governed by the included BSD license.
     3  
     4  package service
     5  
     6  import (
     7  	"github.com/keybase/client/go/libkb"
     8  	keybase1 "github.com/keybase/client/go/protocol/keybase1"
     9  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
    10  	context "golang.org/x/net/context"
    11  )
    12  
    13  // NotifyCtlHandler is the RPC handler for notify control messages
    14  type NotifyCtlHandler struct {
    15  	libkb.Contextified
    16  	*BaseHandler
    17  	id libkb.ConnectionID
    18  }
    19  
    20  // NewNotifyCtlHandler creates a new handler for setting up notification
    21  // channels
    22  func NewNotifyCtlHandler(xp rpc.Transporter, id libkb.ConnectionID, g *libkb.GlobalContext) *NotifyCtlHandler {
    23  	return &NotifyCtlHandler{
    24  		Contextified: libkb.NewContextified(g),
    25  		BaseHandler:  NewBaseHandler(g, xp),
    26  		id:           id,
    27  	}
    28  }
    29  
    30  func (h *NotifyCtlHandler) SetNotifications(_ context.Context, n keybase1.NotificationChannels) error {
    31  	h.G().NotifyRouter.SetChannels(h.id, n)
    32  	return nil
    33  }