Index: plugins/roard/protocol-gopher.c
===================================================================
--- plugins/roard/protocol-gopher.c	(revision 5740)
+++ plugins/roard/protocol-gopher.c	(revision 5741)
@@ -26,14 +26,4 @@
 #include <roard/include/roard.h>
 
-#ifndef DISTRIBUTION_VERSION_STRING
-#define DISTRIBUTION_VERSION_STRING ""
-#endif
-#ifndef PACKAGE_VERSION
-#define PACKAGE_VERSION ""
-#endif
-#ifndef DEVICE_VENDOR_STRING
-#define DEVICE_VENDOR_STRING ""
-#endif
-
 #ifndef ROAR_WITHOUT_DCOMP_EMUL_GOPHER
 #include <roaraudio/proto_gopher.h>
@@ -46,12 +36,12 @@
 struct item;
 
-static int scb_status_txt (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem);
-static int scb_test       (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem);
-static int scb_clients    (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem);
-static int scb_streams    (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem);
-static int scb_client_info(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem);
-static int scb_stream_info(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem);
-static int scb_listen_menu(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem);
-static int scb_listen     (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem);
+static int scb_status_txt (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
+static int scb_test       (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
+static int scb_clients    (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
+static int scb_streams    (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
+static int scb_client_info(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
+static int scb_stream_info(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
+static int scb_listen_menu(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
+static int scb_listen     (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
 
 static struct roar_gopher_menu_item g_gopher_root_menu[] = {
@@ -78,5 +68,5 @@
  int dir;
  const char * text;
- int (*cb)(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem);
+ int (*cb)(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara);
 } g_gopher_items[] = {
  {.selector = "", .type = _DIR,
@@ -102,20 +92,13 @@
 static char * _aprintf(size_t sizehint, const char * format, ...);
 
-static int send_menu (int client, struct roar_gopher_menu * menu, struct roar_vio_calls * vio);
+static int send_menu (int client, struct roar_gopher_menu * menu, struct roar_vio_calls * vio, struct roar_buffer ** obuffer);
 static int send_text (const char * text, struct roar_buffer ** obuffer);
 
 
 // SCBs:
-static int scb_status_txt (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem) {
+static int scb_status_txt (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
  const size_t len = 1024;
- const char * server_version = NULL;
-
- (void)client, (void)vio, (void)selector, (void)text, (void)sitem;
-
- if ( DISTRIBUTION_VERSION_STRING[0] == 0 ) {
-  server_version = "roard/" PACKAGE_VERSION " <" DEVICE_VENDOR_STRING ">";
- } else {
-  server_version = "roard/" PACKAGE_VERSION " <" DEVICE_VENDOR_STRING "> (" DISTRIBUTION_VERSION_STRING ")";
- }
+
+ (void)client, (void)vio, (void)selector, (void)text, (void)sitem, (void)obuffer;
 
  *text = roar_mm_malloc(len);
@@ -126,5 +109,6 @@
 
  snprintf(*text, len,
-          "Server version:     %s\r\n"
+          "Host application:   %s\r\n"
+          "Host ABI:           %s\r\n"
           "Server location:    %s\r\n"
           "Server description: %s\r\n"
@@ -132,5 +116,6 @@
           "Counters current:   %llu clients, %llu streams\r\n"
           "Counters sum:       %llu clients, %llu streams\r\n",
-          server_version,
+          pluginpara->appname    == NULL ? "***unknown***" : pluginpara->appname,
+          pluginpara->abiversion == NULL ? "***unknown***" : pluginpara->abiversion,
           g_config->location,
           g_config->description,
@@ -145,10 +130,10 @@
 }
 
-static int scb_test(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem) {
+static int scb_test(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
  ssize_t toks;
  char * tok;
  size_t len;
 
- (void)client, (void)vio;
+ (void)client, (void)vio, (void)obuffer, (void)pluginpara;
 
  toks = roar_mm_strseltok(sitem->selector, selector, &tok, 1);
@@ -160,5 +145,5 @@
  len += 64;
 
- *text = roar_mm_malloc(1024);
+ *text = roar_mm_malloc(len);
  if ( *text == NULL )
   return -1;
@@ -173,5 +158,5 @@
 }
 
-static int scb_clients    (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem) {
+static int scb_clients    (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
  struct roar_gopher_menu_item items[ROAR_CLIENTS_MAX];
  struct roar_gopher_menu menu = {.flags = 0, .items = items, .items_len = 0};
@@ -184,5 +169,5 @@
  int ret;
 
- (void)selector, (void)text, (void)sitem;
+ (void)selector, (void)text, (void)sitem, (void)pluginpara;
 
  memset(items, 0, sizeof(items));
@@ -217,5 +202,5 @@
  }
 
- ret = send_menu(client, &menu, vio);
+ ret = send_menu(client, &menu, vio, obuffer);
 
  for (i = 0; i < menu.items_len; i++) {
@@ -229,5 +214,5 @@
 }
 
-static int scb_streams    (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem) {
+static int scb_streams    (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
  struct roar_gopher_menu_item items[ROAR_STREAMS_MAX];
  struct roar_gopher_menu menu = {.flags = 0, .items = items, .items_len = 0};
@@ -240,5 +225,5 @@
  int ret;
 
- (void)selector, (void)text, (void)sitem;
+ (void)selector, (void)text, (void)sitem, (void)pluginpara;
 
  memset(items, 0, sizeof(items));
@@ -273,5 +258,5 @@
  }
 
- ret = send_menu(client, &menu, vio);
+ ret = send_menu(client, &menu, vio, obuffer);
 
  for (i = 0; i < menu.items_len; i++) {
@@ -285,5 +270,5 @@
 }
 
-static int scb_client_info(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem) {
+static int scb_client_info(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
 #define _MAX_ITEMS (16 + ROAR_CLIENTS_MAX_STREAMS_PER_CLIENT)
  struct roar_gopher_menu_item items[_MAX_ITEMS];
@@ -299,5 +284,5 @@
  char tmp[80];
 
- (void)text;
+ (void)text, (void)pluginpara;
 
  memset(items, 0, sizeof(items));
@@ -350,5 +335,5 @@
  }
 
- ret = send_menu(client, &menu, vio);
+ ret = send_menu(client, &menu, vio, obuffer);
 
  for (i = 0; i < menu.items_len; i++) {
@@ -363,5 +348,5 @@
 }
 
-static int scb_stream_info(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem) {
+static int scb_stream_info(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
 #define _MAX_ITEMS 12
  struct roar_gopher_menu_item items[_MAX_ITEMS];
@@ -376,5 +361,5 @@
  int id;
 
- (void)text;
+ (void)text, (void)pluginpara;
 
  memset(items, 0, sizeof(items));
@@ -430,5 +415,5 @@
  item->selector = _aprintf(64, "/clients/%i/", ss->client);
 
- ret = send_menu(client, &menu, vio);
+ ret = send_menu(client, &menu, vio, obuffer);
 
  for (i = 0; i < menu.items_len; i++) {
@@ -443,5 +428,5 @@
 }
 
-static int scb_listen_menu(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem) {
+static int scb_listen_menu(int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
 #define _MAX_ITEMS 12
  struct roar_gopher_menu_item items[_MAX_ITEMS];
@@ -453,5 +438,5 @@
  size_t i;
 
- (void)selector, (void)text, (void)sitem;
+ (void)selector, (void)text, (void)sitem, (void)pluginpara;
 
  memset(items, 0, sizeof(items));
@@ -474,5 +459,5 @@
  }
 
- ret = send_menu(client, &menu, vio);
+ ret = send_menu(client, &menu, vio, obuffer);
 
  for (i = 0; i < menu.items_len; i++) {
@@ -487,5 +472,5 @@
 }
 
-static int scb_listen     (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem) {
+static int scb_listen     (int client, struct roar_vio_calls * vio, char * selector, char ** text, struct item * sitem, struct roar_buffer ** obuffer, struct roar_dl_librarypara * pluginpara) {
  struct roar_stream_server * ss;
  struct roar_stream        * s;
@@ -496,5 +481,5 @@
  int stream = -1;
 
- (void)vio, (void)text;
+ (void)vio, (void)text, (void)obuffer, (void)pluginpara;
 
  toks = roar_mm_strseltok(sitem->selector, selector, tok, 5);
@@ -589,5 +574,5 @@
 }
 
-static int send_menu (int client, struct roar_gopher_menu * menu, struct roar_vio_calls * vio) {
+static int send_menu (int client, struct roar_gopher_menu * menu, struct roar_vio_calls * vio, struct roar_buffer ** obuffer) {
  struct roar_buffer * buf;
  struct roar_gopher_menu_item * item;
@@ -600,4 +585,6 @@
  struct roar_sockname sockaddr;
 
+ (void)client;
+
  if ( roar_vio_ctl(vio, ROAR_VIO_CTL_GET_SOCKNAME, &sockaddr) == -1 ) {
   memset(&sockaddr, 0, sizeof(sockaddr));
@@ -629,8 +616,15 @@
   if ( roar_buffer_set_len(buf, strlen(data)) == -1 ) {
    roar_buffer_free(buf);
+   if ( sockaddr.addr != NULL )
+    roar_mm_free(sockaddr.addr);
    return -1;
   }
 
-  clients_add_output(client, &buf);
+  if ( roar_buffer_moveintoqueue(obuffer, &buf) == -1 ) {
+   roar_buffer_free(buf);
+   if ( sockaddr.addr != NULL )
+    roar_mm_free(sockaddr.addr);
+   return -1;
+  }
  }
 
@@ -744,5 +738,5 @@
  if ( c->cb != NULL ) {
   text = NULL;
-  funcret = c->cb(client, vio, inbuf, &text, c);
+  funcret = c->cb(client, vio, inbuf, &text, c, obuffer, pluginpara);
 
   if ( funcret == 0 && text != NULL )
@@ -754,5 +748,5 @@
   switch (c->type) {
    case _DIR:
-     funcret = send_menu(client, &(c->menu), vio);
+     funcret = send_menu(client, &(c->menu), vio, obuffer);
     break;
    case _FILE:
