- Timestamp:
- May 25, 2021, 5:22:22 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/soju.1.scd
r525 r539 187 187 Show a list of saved networks and their current status. 188 188 189 *channel status* [options...] 190 Show a list of saved channels and their current status. 191 192 Options: 193 194 *-network* <name> 195 Only show channels for the specified network. By default, only the 196 channels in the current network are displayed. 197 189 198 *channel update* <name> [options...] 190 199 Update the options of an existing channel. -
trunk/service.go
r508 r539 222 222 "channel": { 223 223 children: serviceCommandSet{ 224 "status": { 225 usage: "[-network name]", 226 desc: "show a list of saved channels and their current status", 227 handle: handleServiceChannelStatus, 228 }, 224 229 "update": { 225 230 usage: "<name> [-relay-detached <default|none|highlight|message>] [-reattach-on <default|none|highlight|message>] [-detach-after <duration>] [-detach-on <default|none|highlight|message>]", … … 708 713 } 709 714 715 func handleServiceChannelStatus(dc *downstreamConn, params []string) error { 716 var defaultNetworkName string 717 if dc.network != nil { 718 defaultNetworkName = dc.network.GetName() 719 } 720 721 fs := newFlagSet() 722 networkName := fs.String("network", defaultNetworkName, "") 723 724 if err := fs.Parse(params); err != nil { 725 return err 726 } 727 728 sendNetwork := func(net *network) { 729 for _, entry := range net.channels.innerMap { 730 ch := entry.value.(*Channel) 731 732 var uch *upstreamChannel 733 if net.conn != nil { 734 uch = net.conn.channels.Value(ch.Name) 735 } 736 737 name := ch.Name 738 if *networkName == "" { 739 name += "/" + net.GetName() 740 } 741 742 var status string 743 if uch != nil { 744 status = "joined" 745 } else if net.conn != nil { 746 status = "parted" 747 } else { 748 status = "disconnected" 749 } 750 751 if ch.Detached { 752 status += ", detached" 753 } 754 755 s := fmt.Sprintf("%v [%v]", name, status) 756 sendServicePRIVMSG(dc, s) 757 } 758 } 759 760 if *networkName == "" { 761 dc.user.forEachNetwork(sendNetwork) 762 } else { 763 net := dc.user.getNetwork(*networkName) 764 if net == nil { 765 return fmt.Errorf("unknown network %q", *networkName) 766 } 767 sendNetwork(net) 768 } 769 770 return nil 771 } 772 710 773 type channelFlagSet struct { 711 774 *flag.FlagSet
Note:
See TracChangeset
for help on using the changeset viewer.