if err != nil {
log.Fatalln(err)
}
+ UsersDC := make(map[string]*model.Channel, len(Users))
for _, u := range Users {
pth := path.Join("users", strings.ReplaceAll(u.Username, ".", "_"))
os.MkdirAll(pth, 0777)
log.Fatalln(err)
}
}
- updateQueue = append(updateQueue,
- pth, u.Id+"__"+me.Id,
- pth, me.Id+"__"+u.Id,
- )
+
+ if fi, err := os.Stat(path.Join(pth, mmc.OutRec)); err == nil && fi.Size() > 0 {
+ time.Sleep(mmc.SleepTime)
+ dc, resp, err := c.CreateDirectChannel(me.Id, u.Id)
+ if err != nil {
+ if DebugFd != nil {
+ spew.Fdump(DebugFd, resp)
+ }
+ log.Println("CreateDirectChannel:", err)
+ continue
+ }
+ if DebugFd != nil {
+ spew.Fdump(DebugFd, dc)
+ }
+ UsersDC[u.Id] = dc
+ updateQueue = append(updateQueue, pth, dc.Id)
+ }
statusPth := path.Join(pth, "status")
os.Remove(statusPth)
if err != nil {
continue
}
+ dc = UsersDC[u.Id]
if dc == nil {
dc, resp, err = c.CreateDirectChannel(me.Id, u.Id)
if err != nil {
log.Println("CreateDirectChannel:", err)
continue
}
+ UsersDC[u.Id] = dc
if DebugFd != nil {
spew.Fdump(DebugFd, dc)
}
}(ch)
}
- go func() {
- log.Println("syncing", len(Chans)+len(Users), "rooms")
- for len(updateQueue) > 0 {
- err := updatePosts(c, Users, updateQueue[0], updateQueue[1])
- if err != nil {
- log.Println("updatePosts:", err)
- }
- updateQueue = updateQueue[2:]
+ log.Println("syncing", len(updateQueue)/2, "rooms")
+ for len(updateQueue) > 0 {
+ err := updatePosts(c, Users, updateQueue[0], updateQueue[1])
+ if err != nil {
+ log.Println("updatePosts:", err)
}
- log.Println("sync done")
- }()
+ updateQueue = updateQueue[2:]
+ }
+ log.Println("sync done")
+ if *notifyCmd != "" {
+ exec.Command(*notifyCmd, "sync done").Run()
+ }
go func() {
os.MkdirAll("file", 0777)
@item Get the @url{git://git.stargrave.org/mmc.git, source code} and
compile Go programs in @file{cmd} subdirectory.
+@example
+for c (cmd/rd cmd/mmc cmd/scrollback cmd/ch-leave) @{
+ pushd $c ; go build -ldflags=-s ; popd
+@}
+@end example
+
@item Create and change to the directory where the state will be kept.
@item Place your MM's credentials to @env{$NETRC} (@file{~/.netrc} by
@file{FILEID.tar} archive in current directory.
@item After you just logged in, @command{cmd/mmc} checks for new
-messages since you were offline. So some windows could be automatically
-opened because of new messages.
+messages since you were offline, if any messages were in the state's
+history. So some windows could be automatically opened because of new
+messages.
@item By pressing @code{Prefix+Q} you will destroy the whole session and
quit @command{tmux}.
@item @command{cmd/mmc} heartbeats server each minute to tell that you
are online, preventing you becoming away.
+@item You can preliminary fill your history:
+
+@example
+for c (users/*(/) chans/*(/)) @{
+ cmd/scrollback -whole `cat $c/id` > $c/out.rec
+ cmd/last-update < $c/out.rec > $c/last
+@}
+@end example
+
@end enumerate