appending one list to another should leave the first list empty, and not require...
[asterisk-bristuff.git] / pbx / kdeconsole_main.cc
blob0bb2d73e2acd5e7292d8253c3d20dd9b9d53a138
1 /*
2 * Asterisk -- A telephony toolkit for Linux.
4 * KDE Console monitor -- Mostly glue code
5 *
6 * Copyright (C) 1999, Mark Spencer
8 * Mark Spencer <markster@linux-support.net>
10 * This program is free software, distributed under the terms of
11 * the GNU General Public License
14 #include "asterisk/module.h"
15 #include "asterisk/channel.h"
16 #include "asterisk/logger.h"
17 #include "asterisk/lock.h"
18 #include "pbx_kdeconsole.h"
20 static char *dtext = "KDE Console Monitor";
22 static int inuse = 0;
24 static KAsteriskConsole *w;
26 static void verboser(char *stuff, int opos, int replacelast, int complete)
28 const char *s2[2];
29 s2[0] = stuff;
30 s2[1] = NULL;
31 if (replacelast) {
32 printf("Removing %d\n", w->verbose->count());
33 w->verbose->removeItem(w->verbose->count());
35 w->verbose->insertStrList(s2, 1, -1);
36 w->verbose->setBottomItem(w->verbose->count());
39 static int kde_main(int argc, char *argv[])
41 KApplication a ( argc, argv );
42 w = new KAsteriskConsole();
43 a.setMainWidget(w);
44 w->show();
45 ast_register_verbose(verboser);
46 return a.exec();
49 static void *kdemain(void *data)
51 /* It would appear kde really wants to be main */;
52 char *argv[1] = { "asteriskconsole" };
53 kde_main(1, argv);
54 return NULL;
57 extern "C" {
59 int unload_module(void)
61 return inuse;
64 int load_module(void)
66 pthread_t t;
67 pthread_create(&t, NULL, kdemain, NULL);
68 return 0;
71 int usecount(void)
73 return inuse;
76 char *description(void)
78 return dtext;