// ChannelEdit edits the given channel
// channelID  : The ID of a Channel
// name       : The new name to assign the channel.
8062
func (s *Session) ChannelEdit(channelID, name string) (*Channel, error) {
	return s.ChannelEditComplex(channelID, &ChannelEdit{
		Name: name,
	})
}
1081756
func (s *StartChannelInput) SetChannelId(v string) *StartChannelInput {
	s.ChannelId = &v
	return s
}
1113803
func (s *Session) ChannelMessageEdit(channelID, messageID, content string) (*Message, error) {
	return s.ChannelMessageEditComplex(NewMessageEdit(channelID, messageID).SetContent(content))
}
567207
func NewCmdEdit(fullName string, f kcmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
	cmd := edit.NewCmdEdit(f, streams)
	cmd.Long = editLong
	cmd.Example = fmt.Sprintf(editExample, fullName)
	return cmd
}
1370166
func (m *ChannelMap) Name() (string, error) {
	cstr := C.pa_channel_map_to_name(m.toC())
	if cstr == nil {
		return "", errors.New("No name found for channel mapping.")
	}
	return C.GoString(cstr), nil
}
944707
func (s *DescribeChannelInput) SetChannelName(v string) *DescribeChannelInput {
	s.ChannelName = &v
	return s
}
1285319
func (r *ChannelRouter) AddProof(chanID lnwire.ShortChannelID,
	proof *channeldb.ChannelAuthProof) error {

	info, _, _, err := r.cfg.Graph.FetchChannelEdgesByID(chanID.ToUint64())
	if err != nil {
		return err
	}

	info.AuthProof = proof
	return r.cfg.Graph.UpdateChannelEdge(info)
}
2903
func (s *Session) ChannelTyping(channelID string) (err error) {

	_, err = s.RequestWithBucketID("POST", EndpointChannelTyping(channelID), nil, EndpointChannelTyping(channelID))
	return
}
281554
func (s *Session) ChannelFileSend(channelID, name string, r io.Reader) (*Message, error) {
	return s.ChannelMessageSendComplex(channelID, &MessageSend{File: &File{Name: name, Reader: r}})
}
467137
func (s *ChannelActivity) SetChannelName(v string) *ChannelActivity {
	s.ChannelName = &v
	return s
}
622990
func AddChannel(ident, channelName, user, organization string) error {
	query := utils.M{
		"org":   organization,
		"user":  user,
		"ident": ident,
	}

	spec := utils.M{
		"$addToSet": utils.M{
			"channels": db.Channel{Name: channelName, Enabled: true},
		},
	}

	result := utils.M{}

	_, err := db.Conn.FindAndUpdate(db.TopicCollection, query, spec, &result)
	return err
}
1018473
func (c *Channel) SetName(name string) {
	packet := MumbleProto.ChannelState{
		ChannelId: &c.ID,
		Name:      &name,
	}
	c.client.Conn.WriteProto(&packet)
}
648412
func (s *BatchPutMessageInput) SetChannelName(v string) *BatchPutMessageInput {
	s.ChannelName = &v
	return s
}
425784
func (api *Client) RenameConversation(channelID, channelName string) (*Channel, error) {
	return api.RenameConversationContext(context.Background(), channelID, channelName)
}
140430
func profileEdit(ctx *cli.Context) error {
	cfg, err := config.LoadConfig()
	if err != nil {
		return err
	}

	client := api.NewClient(cfg)
	c := context.Background()

	session, err := client.Session.Who(c)
	if err != nil {
		return errs.NewErrorExitError("Error fetching user details", err)
	}
	if session.Type() == apitypes.MachineSession {
		return errs.NewExitError("Machines cannot update profiles")
	}

	ogName := session.Name()
	name, err := prompts.FullName(ogName, false)
	if err != nil {
		return err
	}

	ogEmail := session.Email()
	email, err := prompts.Email(ogEmail, false)
	if err != nil {
		return err
	}

	question := "Would you like to change your password"
	success, err := prompts.Confirm(&question, nil, false, false)
	if err != nil {
		return errs.NewErrorExitError("Failed to answer question", err)
	}

	var newPassword string
	if success {
		password, err := changePassword(&c, client, session)
		if err != nil {
			return err
		}
		newPassword = password
	}

	// Don't perform any action if no changes occurred
	if ogEmail == email && ogName == name && newPassword == "" {
		fmt.Println("\nNo changes made :)")
		return nil
	}

	// Construct the update payload
	delta := apitypes.ProfileUpdate{}
	mustVerify := false
	if ogEmail != email {
		delta.Email = email
		mustVerify = true
	}
	if ogName != name {
		delta.Name = name
	}
	if newPassword != "" {
		delta.Password = newPassword
	}

	preamble := "\nYou are about to update your profile to the values entered above."
	if email != ogEmail {
		preamble = "\nYou will be required to re-verify your email address before taking any further actions within Torus."
	}
	success, err = prompts.Confirm(nil, &preamble, false, true)
	if err != nil {
		return errs.NewErrorExitError("Failed to retrieve confirmation", err)
	}
	if !success {
		return errs.ErrAbort
	}

	// Update the profile
	result, err := client.Users.Update(c, delta)
	if err != nil {
		return errs.NewErrorExitError("Failed to update profile.", err)
	}
	currentEmail := result.Email()

	// If the password has changed, log the user in again
	if newPassword != "" {
		err = performLogin(c, client, currentEmail, newPassword, false)
		if err != nil {
			return err
		}
	}

	if mustVerify {
		fmt.Println("")
		fmt.Println("A verification code has been sent to your new email address.")
		fmt.Println("Please verify this change by entering the code below.")
		fmt.Println("")

		if err = askToVerify(ctx); err != nil {
			return err
		}
	}

	// Output the final session details
	updatedSession, err := client.Session.Who(c)
	if err != nil {
		return errs.NewErrorExitError("Error fetching user details", err)
	}

	fmt.Println("")

	printProfile(updatedSession)
	return nil
}
235701
func (s *CreateChannelOutput) SetChannelName(v string) *CreateChannelOutput {
	s.ChannelName = &v
	return s
}
916085
func ChannelUpdateFromEdge(info *channeldb.ChannelEdgeInfo,
	policy *channeldb.ChannelEdgePolicy) (*lnwire.ChannelUpdate, error) {

	update := &lnwire.ChannelUpdate{
		ChainHash:       info.ChainHash,
		ShortChannelID:  lnwire.NewShortChanIDFromInt(policy.ChannelID),
		Timestamp:       uint32(policy.LastUpdate.Unix()),
		ChannelFlags:    policy.ChannelFlags,
		MessageFlags:    policy.MessageFlags,
		TimeLockDelta:   policy.TimeLockDelta,
		HtlcMinimumMsat: policy.MinHTLC,
		HtlcMaximumMsat: policy.MaxHTLC,
		BaseFee:         uint32(policy.FeeBaseMSat),
		FeeRate:         uint32(policy.FeeProportionalMillionths),
		ExtraOpaqueData: policy.ExtraOpaqueData,
	}

	var err error
	update.Signature, err = lnwire.NewSigFromRawSignature(policy.SigBytes)
	if err != nil {
		return nil, err
	}

	return update, nil
}