[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet-nim] branch master updated: Revert "try out nimbox"
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet-nim] branch master updated: Revert "try out nimbox" |
Date: |
Sun, 26 Aug 2018 19:51:51 +0200 |
This is an automated email from the git hooks/post-receive script.
lurchi pushed a commit to branch master
in repository gnunet-nim.
The following commit(s) were added to refs/heads/master by this push:
new 03c6430 Revert "try out nimbox"
03c6430 is described below
commit 03c64300c78b085f7d115090e0f0ef54cace6cc6
Author: lurchi <address@hidden>
AuthorDate: Sun Aug 26 19:51:26 2018 +0200
Revert "try out nimbox"
This reverts commit 9bb383003464cbe6e0fe0abc2a9a060bbaf70be6.
---
examples/groupchat.nim | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/examples/groupchat.nim b/examples/groupchat.nim
index 7b3ac82..93d4323 100644
--- a/examples/groupchat.nim
+++ b/examples/groupchat.nim
@@ -1,5 +1,5 @@
import ../gnunet_application, ../asynccadet, ../gnunet_utils
-import asyncdispatch, asyncfile, parseopt, strutils, sequtils, times, os,
nimbox
+import asyncdispatch, asyncfile, parseopt, strutils, sequtils, times, os
type Chat = object
channels: seq[ref CadetChannel]
@@ -28,17 +28,10 @@ proc processServerMessages(channel: ref CadetChannel)
{.async.} =
return
echo getDateStr()," ",getClockStr()," ",message
-proc processInput(inputFile: AsyncFile, channel: ref CadetChannel, nb: NimBox)
{.async.} =
- var line = ""
+proc processInput(inputFile: AsyncFile, channel: ref CadetChannel) {.async.} =
while true:
- let ch = await inputFile.read(1)
- case ch
- of "\n":
- line = ""
- else:
- line.add(ch)
- nb.print(0, 11, line)
- nb.present()
+ let input = await inputFile.readline()
+ channel.sendMessage(input)
proc firstTask(gnunetApp: ref GnunetApplication,
server: string,
@@ -49,10 +42,8 @@ proc firstTask(gnunetApp: ref GnunetApplication,
if not server.isNil():
let inputFile = openAsync("/dev/stdin", fmRead)
let channel = cadet.createChannel(server, port)
- let nb = newNimbox()
- await processServerMessages(channel) or processInput(inputFile, channel,
nb)
+ await processServerMessages(channel) or processInput(inputFile, channel)
inputFile.close()
- nb.shutdown()
else:
let cadetPort = cadet.openPort(port)
while true:
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet-nim] branch master updated: Revert "try out nimbox",
gnunet <=