/* Add this to the daemon:


This file should be included.
#include "msgsend.c"


Define the message
char pop_msg[128];

This function should be called, after the user has been
successfully authenticated.
pbs_message(pop_msg);


Here is how I did it in solid-pop3:
<Line 1416 V0.15>
			strcpy(pop_msg," ");
                        strncat(pop_msg,ahname,20);
			strcat(pop_msg," ");
                        strncat(pop_msg,username,50);
                        pbs_message(pop_msg);

*/

#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#define MSGSZ 128



typedef struct msgbuf {
         long    mtype;
         char    mtext[MSGSZ];
         } message_buf;



void pbs_message(char *nachricht)
   {

         key_t key;                   /* Schluesselzahl    */
         int msg_id;                  /* ipc descriptor    */
     message_buf sbuf;
    size_t buf_length;

         key = ftok("/tmp/pop",77);

         // Pascal = > IPC_ID:=msgget(IPC_Key,IPC_CREAT or 438);
         msg_id=msgget(key,( 0666));
         // Pascal = > if IPC_ID<0 then exit;  // Raus aus der Procedure wenn Fehler
         if (msg_id>0) {
            sbuf.mtype=1;
            (void) strcpy(sbuf.mtext,nachricht);
            buf_length = strlen(sbuf.mtext) + 1 ;
            msgsnd(msg_id, &sbuf, buf_length, IPC_NOWAIT);
           }


   }