#include        <iodef.h>
#include        "bob$talk:talk.h"

cmd_unmod(np)	/* unmoderate a conference */
        int     np;     /* number of parameters on command line         */

{
extern  int     master_chan;    /* master communications channel        */
extern  int     talk_port;      /* our talk port number                 */
extern  int     inc_chan;       /* out incomming message channel        */

        TALKMSG talkmsg;
        short   iosb[4];

        if (np != -1) /* no parameters allowed */
            printf("Invalid number of parameters.\r\n");
        else {
            talkmsg.tm_port = talk_port;
            talkmsg.tm_type = TALKM_UNMOD;
            sys$qiow(0, master_chan, IO$_WRITEVBLK | IO$M_NOW, iosb,
                0, 0, &talkmsg, TMSIZE, 0, 0, 0, 0);

            do {
                sys$qiow(0, inc_chan, IO$_READVBLK, iosb,
                    0, 0, &talkmsg, TMSIZE, 0, 0, 0, 0);
                switch(talkmsg.tm_type) {
                    case TALKM_LINE:    buffer_line(talkmsg.tm_msg);
                                        break;
                    case TALKM_BAD:
                    case TALKM_GOOD:    printf("%s\r\n", talkmsg.tm_msg);
                                        break;
                    default:            printf("bad type %d\r\n", talkmsg.tm_type);
                                        break;
                }
            } while ((talkmsg.tm_type != TALKM_BAD) && 
                     (talkmsg.tm_type != TALKM_GOOD));
        }
}
