/*
 * 4m v2.15 (send.c)
 * (C) Copyright 1990 by Carrick Sean Casey
 * (C) Copyright 1993 by Scott Chasin and Michaeljon Miller
 *
 * 3-24-93 See file COPYING for copyright information.
 *
 * Packet exporting
 */

#include "4m.h"
#include "externs.h"

extern void sendit();

/* send normal open group message to the server */

void c_sendopen(txt)
     char *txt;
{
    sprintf(pbuf, "%d %s\n", M_OPEN, txt);
    *pp = (unsigned char) (strlen(pbuf) + 1);

    sendit(pbuf);

    return;
}


/* send a login packet */

void sendlogin(id, nick, group, command)
     char *id;
     char *nick;
     char *group;
     char *command;
{

    sprintf(pbuf, "%d %s %s %s %s %s\n",
            M_LOGIN, command, id, nick, group, VERSION);
    *pp = (unsigned char) (strlen(pbuf) + 1);

    sendit(pbuf);

    return;
}

/* send a pong */
void sendpong()
{
    *pbuf = M_PONG;
    *pp = 1;
    sendit(pbuf);

    return;
}


/* send a command to the server */

void sendcmd(cmd, args)
     char *cmd;
     char *args;
{
    sprintf(pbuf, "%d %s %s\n", M_COMMAND, cmd, args);
    *pp = (unsigned char) (strlen(pbuf) + 1);

    sendit(pbuf);

    return;
}
