Rename project to soju

This commit is contained in:
Simon Ser 2020-03-13 18:13:03 +01:00
parent 2239b94399
commit f3940117d1
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
12 changed files with 29 additions and 29 deletions

View File

@ -1,4 +1,4 @@
# jounce # soju
A user-friendly IRC bouncer. A user-friendly IRC bouncer.
@ -10,11 +10,11 @@ A user-friendly IRC bouncer.
## Usage ## Usage
sqlite3 jounce.db <schema.sql sqlite3 soju.db <schema.sql
go run ./cmd/jouncectl create-user jounce go run ./cmd/sojuctl create-user soju
go run ./cmd/jounce go run ./cmd/soju
Then connect with username `jounce@chat.freenode.net` and join `#jounce`. Then connect with username `soju@chat.freenode.net` and join `#soju`.
## Contributing ## Contributing
@ -27,4 +27,4 @@ AGPLv3, see LICENSE.
Copyright (C) 2020 Simon Ser Copyright (C) 2020 Simon Ser
[mailing list]: https://lists.sr.ht/~emersion/public-inbox [mailing list]: https://lists.sr.ht/~emersion/public-inbox
[issue tracker]: https://todo.sr.ht/~emersion/jounce [issue tracker]: https://todo.sr.ht/~emersion/soju

View File

@ -1,4 +1,4 @@
package jounce package soju
import ( import (
"gopkg.in/irc.v3" "gopkg.in/irc.v3"

View File

@ -6,8 +6,8 @@ import (
"log" "log"
"net" "net"
"git.sr.ht/~emersion/jounce" "git.sr.ht/~emersion/soju"
"git.sr.ht/~emersion/jounce/config" "git.sr.ht/~emersion/soju/config"
) )
func main() { func main() {
@ -33,7 +33,7 @@ func main() {
cfg.Addr = addr cfg.Addr = addr
} }
db, err := jounce.OpenSQLDB(cfg.SQLDriver, cfg.SQLSource) db, err := soju.OpenSQLDB(cfg.SQLDriver, cfg.SQLSource)
if err != nil { if err != nil {
log.Fatalf("failed to open database: %v", err) log.Fatalf("failed to open database: %v", err)
} }
@ -58,7 +58,7 @@ func main() {
} }
} }
srv := jounce.NewServer(db) srv := soju.NewServer(db)
// TODO: load from config/DB // TODO: load from config/DB
srv.Hostname = cfg.Hostname srv.Hostname = cfg.Hostname
srv.Debug = debug srv.Debug = debug

View File

@ -6,13 +6,13 @@ import (
"log" "log"
"os" "os"
"git.sr.ht/~emersion/jounce" "git.sr.ht/~emersion/soju"
"git.sr.ht/~emersion/jounce/config" "git.sr.ht/~emersion/soju/config"
"golang.org/x/crypto/bcrypt" "golang.org/x/crypto/bcrypt"
"golang.org/x/crypto/ssh/terminal" "golang.org/x/crypto/ssh/terminal"
) )
const usage = `usage: jouncectl [-config path] <action> [options...] const usage = `usage: sojuctl [-config path] <action> [options...]
create-user <username> Create a new user create-user <username> Create a new user
help Show this help message help Show this help message
@ -40,7 +40,7 @@ func main() {
cfg = config.Defaults() cfg = config.Defaults()
} }
db, err := jounce.OpenSQLDB(cfg.SQLDriver, cfg.SQLSource) db, err := soju.OpenSQLDB(cfg.SQLDriver, cfg.SQLSource)
if err != nil { if err != nil {
log.Fatalf("failed to open database: %v", err) log.Fatalf("failed to open database: %v", err)
} }
@ -65,7 +65,7 @@ func main() {
log.Fatalf("failed to hash password: %v", err) log.Fatalf("failed to hash password: %v", err)
} }
user := jounce.User{ user := soju.User{
Username: username, Username: username,
Password: string(hashed), Password: string(hashed),
} }

View File

@ -30,7 +30,7 @@ func Defaults() *Server {
Addr: ":6667", Addr: ":6667",
Hostname: hostname, Hostname: hostname,
SQLDriver: "sqlite3", SQLDriver: "sqlite3",
SQLSource: "jounce.db", SQLSource: "soju.db",
} }
} }

2
db.go
View File

@ -1,4 +1,4 @@
package jounce package soju
import ( import (
"database/sql" "database/sql"

View File

@ -1,4 +1,4 @@
package jounce package soju
import ( import (
"crypto/tls" "crypto/tls"
@ -410,7 +410,7 @@ func (dc *downstreamConn) register() error {
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
Command: irc.RPL_WELCOME, Command: irc.RPL_WELCOME,
Params: []string{dc.nick, "Welcome to jounce, " + dc.nick}, Params: []string{dc.nick, "Welcome to soju, " + dc.nick},
}) })
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
@ -425,7 +425,7 @@ func (dc *downstreamConn) register() error {
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
Command: irc.RPL_MYINFO, Command: irc.RPL_MYINFO,
Params: []string{dc.nick, dc.srv.Hostname, "jounce", "aiwroO", "OovaimnqpsrtklbeI"}, Params: []string{dc.nick, dc.srv.Hostname, "soju", "aiwroO", "OovaimnqpsrtklbeI"},
}) })
// TODO: RPL_ISUPPORT // TODO: RPL_ISUPPORT
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{

2
go.mod
View File

@ -1,4 +1,4 @@
module git.sr.ht/~emersion/jounce module git.sr.ht/~emersion/soju
go 1.13 go 1.13

2
irc.go
View File

@ -1,4 +1,4 @@
package jounce package soju
import ( import (
"fmt" "fmt"

View File

@ -1,4 +1,4 @@
package jounce package soju
import ( import (
"sync" "sync"
@ -86,7 +86,7 @@ type RingConsumer struct {
// diff returns the number of pending messages. It assumes the Ring is locked. // diff returns the number of pending messages. It assumes the Ring is locked.
func (rc *RingConsumer) diff() uint64 { func (rc *RingConsumer) diff() uint64 {
if rc.cur > rc.ring.cur { if rc.cur > rc.ring.cur {
panic("jounce: consumer cursor greater than producer cursor") panic("soju: consumer cursor greater than producer cursor")
} }
return rc.ring.cur - rc.cur return rc.ring.cur - rc.cur
} }
@ -95,7 +95,7 @@ func (rc *RingConsumer) diff() uint64 {
// message is returned if no message is available. // message is returned if no message is available.
func (rc *RingConsumer) Peek() *irc.Message { func (rc *RingConsumer) Peek() *irc.Message {
if rc.closed { if rc.closed {
panic("jounce: RingConsumer.Peek called after Close") panic("soju: RingConsumer.Peek called after Close")
} }
rc.ring.lock.Lock() rc.ring.lock.Lock()
@ -112,7 +112,7 @@ func (rc *RingConsumer) Peek() *irc.Message {
i := int(rc.cur % rc.ring.cap) i := int(rc.cur % rc.ring.cap)
msg := rc.ring.buffer[i] msg := rc.ring.buffer[i]
if msg == nil { if msg == nil {
panic("jounce: unexpected nil ring buffer entry") panic("soju: unexpected nil ring buffer entry")
} }
return msg return msg
} }

View File

@ -1,4 +1,4 @@
package jounce package soju
import ( import (
"fmt" "fmt"

View File

@ -1,4 +1,4 @@
package jounce package soju
import ( import (
"crypto/tls" "crypto/tls"