/* pckt_comm.c * * copyright (c) 2000-2003 SeaD * see GPL for copying info * */ #include "echat.h" /* #include "pckt_epak.h" */ #include "pckt_vpak.h" #include "pckt_ppak.h" int pars_number(void) { char ch; register int n; ch = *packet - '0'; for (n = 0; n < MSG_SIZE; n++) packet[n] = packet[n+1]; return ((int) ch); } char *pars_word(void) { register int n, m; for (n = 0; n < MSG_SIZE; n++) if (packet[n] == MSG_SPLIT) break; for (m = ++n, n = 0; m < MSG_SIZE; n++, m++) packet[n] = packet[m]; return (packet); } void recv_message(void) { if (config->packet_vchat || config->packet_qchat) pars_vmessage(); else if (config->packet_pchat) pars_pmessage(); else return; } void send_welcome(void) { if (config->packet_vchat) make_vjoin(); else if (config->packet_qchat) make_qjoin(); else if (config->packet_pchat) { make_pwelcome(); } else return; sock_bsend(); } void send_bye(void) { if (config->packet_vchat) make_vleave(); else if (config->packet_qchat) make_qleave(); else if (config->packet_pchat) { make_pbye(); } else return; sock_bsend(); } void send_join(void) { if (config->packet_vchat) make_vjoin(); else if (config->packet_qchat) make_qjoin(); else if (config->packet_pchat) { make_pwelcome(); make_pjoin(); } else return; sock_bsend(); } void send_leave(void) { if (config->packet_vchat) make_vleave(); else if (config->packet_qchat) make_qleave(); else if (config->packet_pchat) { make_pbye(); make_pleave(); } else return; sock_bsend(); } void send_here(void) { if (config->packet_vchat || config->packet_qchat) make_vhere(); else if (config->packet_pchat) make_phere(); else return; sock_bsend(); } void send_herewe(void) { if (config->packet_vchat || config->packet_qchat) make_vherewe(); else if (config->packet_pchat) make_phereim(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); status_ok(MAKE_SHERE); } void send_herewho(void) { if (config->packet_vchat || config->packet_qchat) make_vherewho(); else if (config->packet_pchat) make_pherewho(); else return; sock_bsend(); } void send_hereim(void) { if (config->packet_vchat || config->packet_qchat) make_vhereim(); else if (config->packet_pchat) make_phereim(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); } void send_chat(void) { if (config->packet_vchat || config->packet_qchat) make_vchat(); else if (config->packet_pchat) make_pchat(); else return; sock_bsend(); status_ok(MAKE_SCHAT); } void send_me(void) { if (config->packet_vchat || config->packet_qchat) make_vme(); else if (config->packet_pchat) make_pme(); else return; sock_bsend(); status_ok(MAKE_SME); } void send_mesg(void) { if (config->packet_vchat || config->packet_qchat) make_vmesg(); else if (config->packet_pchat) make_pmesg(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); status_ok(MAKE_SMESG); } void send_mass(void) { if (config->packet_vchat || config->packet_qchat) make_vmass(); else if (config->packet_pchat) make_pmass(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); status_ok(MAKE_SMASS); } void send_mesgack(void) { if (config->packet_vchat) make_vmesgack(); else if (config->packet_qchat) make_qmesgack(); else if (config->packet_pchat) make_pmesgack(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); } void send_topic(void) { if (config->packet_vchat) make_vtopic(); else if (config->packet_qchat) make_qtopic(); else if (config->packet_pchat) make_ptopic(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); } void send_topicreq(void) { return; } void send_topicnew(void) { if (config->packet_vchat) make_vtopicnew(); else if (config->packet_qchat) make_qtopicnew(); else if (config->packet_pchat) make_ptopicnew(); else return; sock_bsend(); status_ok(MAKE_STOPIC); } void send_nick(void) { if (config->packet_vchat) make_vnick(); else if (config->packet_qchat) make_qnick(); else if (config->packet_pchat) make_pnick(); else return; sock_bsend(); status_ok(MAKE_SNICK); } void send_mode(void) { if (config->packet_vchat) make_vmode(); else if (config->packet_qchat) make_qmode(); else if (config->packet_pchat) make_pmode(); else return; sock_bsend(); status_ok(MAKE_SMODE); } void send_active(void) { if (config->packet_vchat || config->packet_qchat) make_vactive(); else if (config->packet_pchat) make_pactive(); else return; sock_bsend(); status_ok(MAKE_SACTIVE); } void send_privjoin(void) { if (config->packet_vchat) make_vprivatjoin(); else if (config->packet_qchat) make_qprivatjoin(); else if (config->packet_pchat) make_pprivjoin(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); status_ok(MAKE_SPRIVJOIN); } void send_privjoinack(void) { if (config->packet_pchat) make_pprivjoinack(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); } void send_privleave(void) { if (config->packet_vchat) make_vprivatleave(); else if (config->packet_qchat) make_qprivatleave(); else if (config->packet_pchat) make_pprivleave(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); status_ok(MAKE_SPRIVLEAVE); } void send_privchat(void) { if (config->packet_vchat || config->packet_qchat) make_vprivatchat(); else if (config->packet_pchat) make_pchat(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); status_ok(MAKE_SPRIVCHAT); } void send_privme(void) { if (config->packet_vchat || config->packet_qchat) make_vprivatme(); else if (config->packet_pchat) make_pme(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); status_ok(MAKE_SPRIVME); } void send_beep(void) { if (config->packet_vchat || config->packet_qchat) make_vbeepbeep(); else if (config->packet_pchat) make_pbeep(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); status_ok(MAKE_SBEEP); } void send_beepack(void) { if (config->packet_vchat) make_vbeepack(); else if (config->packet_qchat) make_qbeepack(); else if (config->packet_pchat) make_pbeepack(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); } void send_info(void) { if (config->packet_vchat || config->packet_qchat) make_vinfo(); else if (config->packet_pchat) make_pinfo(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); } void send_inform(void) { if (config->packet_vchat) make_vinform(); else if (config->packet_qchat) make_qinform(); else if (config->packet_pchat) make_pinform(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); status_ok(MAKE_SINFO); } void send_exec(void) { if (config->packet_vchat || config->packet_qchat) make_vexec(); else if (config->packet_pchat) make_pexec(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); } void send_execack(void) { if (config->packet_vchat || config->packet_qchat) make_vexecack(); else if (config->packet_pchat) make_pexecack(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); } void send_userchnls(void) { if (config->packet_vchat || config->packet_qchat) make_vuserchnls(); else if (config->packet_pchat) make_pchnls(); else return; sock_bsend(); } void send_userchnlslist(void) { if (config->packet_vchat || config->packet_qchat) make_vuserchnlslist(); else if (config->packet_pchat) make_pchnlslist(); else return; if (config->packet_bcast) sock_bsend(); else sock_usend(); }