My mirror of the Barnard terminal client for Mumble.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vor 10 Jahren
vor 10 Jahren
vor 10 Jahren
vor 10 Jahren
vor 10 Jahren
vor 10 Jahren
vor 10 Jahren
vor 10 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. package barnard // import "layeh.com/barnard"
  2. import (
  3. "fmt"
  4. "net"
  5. "os"
  6. "layeh.com/gumble/gumble"
  7. "layeh.com/gumble/gumbleopenal"
  8. "layeh.com/gumble/gumbleutil"
  9. )
  10. func (b *Barnard) start() {
  11. b.Config.Attach(gumbleutil.AutoBitrate)
  12. b.Config.Attach(b)
  13. var err error
  14. _, err = gumble.DialWithDialer(new(net.Dialer), b.Address, b.Config, &b.TLSConfig)
  15. if err != nil {
  16. fmt.Fprintf(os.Stderr, "%s\n", err)
  17. os.Exit(1)
  18. }
  19. // Audio
  20. if os.Getenv("ALSOFT_LOGLEVEL") == "" {
  21. os.Setenv("ALSOFT_LOGLEVEL", "0")
  22. }
  23. if stream, err := gumbleopenal.New(b.Client); err != nil {
  24. fmt.Fprintf(os.Stderr, "%s\n", err)
  25. os.Exit(1)
  26. } else {
  27. b.Stream = stream
  28. }
  29. }
  30. func (b *Barnard) OnConnect(e *gumble.ConnectEvent) {
  31. b.Client = e.Client
  32. b.Ui.SetActive(uiViewInput)
  33. b.UiTree.Rebuild()
  34. b.Ui.Refresh()
  35. b.UpdateInputStatus(fmt.Sprintf("To: %s", e.Client.Self.Channel.Name))
  36. b.AddOutputLine(fmt.Sprintf("Connected to %s", b.Client.Conn.RemoteAddr()))
  37. if e.WelcomeMessage != nil {
  38. b.AddOutputLine(fmt.Sprintf("Welcome message: %s", esc(*e.WelcomeMessage)))
  39. }
  40. }
  41. func (b *Barnard) OnDisconnect(e *gumble.DisconnectEvent) {
  42. var reason string
  43. switch e.Type {
  44. case gumble.DisconnectError:
  45. reason = "connection error"
  46. }
  47. if reason == "" {
  48. b.AddOutputLine("Disconnected")
  49. } else {
  50. b.AddOutputLine("Disconnected: " + reason)
  51. }
  52. b.UiTree.Rebuild()
  53. b.Ui.Refresh()
  54. }
  55. func (b *Barnard) OnTextMessage(e *gumble.TextMessageEvent) {
  56. b.AddOutputMessage(e.Sender, e.Message)
  57. }
  58. func (b *Barnard) OnUserChange(e *gumble.UserChangeEvent) {
  59. if e.Type.Has(gumble.UserChangeChannel) && e.User == b.Client.Self {
  60. b.UpdateInputStatus(fmt.Sprintf("To: %s", e.User.Channel.Name))
  61. }
  62. b.UiTree.Rebuild()
  63. b.Ui.Refresh()
  64. }
  65. func (b *Barnard) OnChannelChange(e *gumble.ChannelChangeEvent) {
  66. b.UiTree.Rebuild()
  67. b.Ui.Refresh()
  68. }
  69. func (b *Barnard) OnPermissionDenied(e *gumble.PermissionDeniedEvent) {
  70. var info string
  71. switch e.Type {
  72. case gumble.PermissionDeniedOther:
  73. info = e.String
  74. case gumble.PermissionDeniedPermission:
  75. info = "insufficient permissions"
  76. case gumble.PermissionDeniedSuperUser:
  77. info = "cannot modify SuperUser"
  78. case gumble.PermissionDeniedInvalidChannelName:
  79. info = "invalid channel name"
  80. case gumble.PermissionDeniedTextTooLong:
  81. info = "text too long"
  82. case gumble.PermissionDeniedTemporaryChannel:
  83. info = "temporary channel"
  84. case gumble.PermissionDeniedMissingCertificate:
  85. info = "missing certificate"
  86. case gumble.PermissionDeniedInvalidUserName:
  87. info = "invalid user name"
  88. case gumble.PermissionDeniedChannelFull:
  89. info = "channel full"
  90. case gumble.PermissionDeniedNestingLimit:
  91. info = "nesting limit"
  92. }
  93. b.AddOutputLine(fmt.Sprintf("Permission denied: %s", info))
  94. }
  95. func (b *Barnard) OnUserList(e *gumble.UserListEvent) {
  96. }
  97. func (b *Barnard) OnACL(e *gumble.ACLEvent) {
  98. }
  99. func (b *Barnard) OnBanList(e *gumble.BanListEvent) {
  100. }
  101. func (b *Barnard) OnContextActionChange(e *gumble.ContextActionChangeEvent) {
  102. }
  103. func (b *Barnard) OnServerConfig(e *gumble.ServerConfigEvent) {
  104. }