/*
 * version.c
 * (C) Christian Magnusson 2000, Email: d1mag@dtek.chalmers.se
 * This program is copyright, and covered by the Gnu Public License.
 * The Q bot.
 */

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#include "settings.h"
#include "bottypes.h"
#include "globals.h"
#include "dl.h"

void m_version(char *a);

MODULE_PUBLIC int _init_version(void *a, void *b)
{
  dl_command_entry_t *dl = a;
  if(!a) return 0;

  snprintf(dl->help, MAX_COMMAND_HELP_LEN,
	   "/msg %s VERSION\nShow version number and compile date.\n", BOT_NAME);
  snprintf(dl->summary, MAX_COMMAND_SUMMARY_LEN,
	   "Show version number");
  dl->level = 1;
#if 0
  dl->func = m_version;
#else
  dl->func = (void (*)(char*)) DL_sym(dl->val, "m_version");
#endif
  return 1;
}

MODULE_PUBLIC int _remove_version(char *a, char *b)
{
  remove_command("version");
  return 1;
}

MODULE_PUBLIC void m_version(char *a)
{
  char tmp[100];
  say_sender( BOT_WHOIS);
  sprintf(tmp, "Version: %d.%d  (Compiled: "__DATE__")",
	  VERSION_MAJOR, VERSION_MINOR);
  say_sender( tmp);
  return;
}
