egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

compile problems, mod with mysql

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Modules & Programming
View previous topic :: View next topic  
Author Message
mayatekla
Voice


Joined: 08 Sep 2008
Posts: 3

PostPosted: Tue Sep 09, 2008 11:53 am    Post subject: compile problems, mod with mysql Reply with quote

ok, I have been trying to compile this for the last couple days but i cant for the life of me work out whats going wrong... from the error message it seems to be saying its a problem with an inlude of an included header which should be perfectly correct....

Code:
make[2]: Entering directory `/home/xxxxxxxxxxxx/IRC/eggdropStuff/eggdropSource/eggdrop1.6.19/src/mod/al.mod'
gcc -pipe -fPIC -g -O2 -Wall -I. -I../../.. -I../../.. -I../../../src/mod -DHAVE_CONFIG_H   `(mysql_config --cflags)` -DMAKING_MODS -c .././al.mod/al.c
In file included from /usr/include/mysql/mysql.h:76,
                 from .././al.mod/al.c:13:
/usr/include/mysql/my_list.h:31: error: expected identifier or ‘(’ before ‘int’
/usr/include/mysql/my_list.h:31: error: expected ‘)’ before ‘global’
make[2]: *** [../al.o] Error 1
make[2]: Leaving directory `/home/xxxxxxxxxxxx/IRC/eggdropStuff/eggdropSource/eggdrop1.6.19/src/mod/al.mod'
make[1]: *** [al.mod_so] Error 2
make[1]: Leaving directory `/home/xxxxxxxxxxxx/IRC/eggdropStuff/eggdropSource/eggdrop1.6.19/src/mod'
make: *** [modules] Error 2


anyone have any clue whats going on here or what to do with it??

[/code]
Back to top
View user's profile Send private message
mayatekla
Voice


Joined: 08 Sep 2008
Posts: 3

PostPosted: Tue Sep 09, 2008 11:56 am    Post subject: Reply with quote

oh, for reference:

Code:


/*
 *
 *
 *
 *
*/

#define MODULE_NAME "al"
#define MAKING_AL

#include "src/mod/module.h"
#include <mysql.h>
#include <stdio.h>



#undef global

static Function *global = NULL;

static void do_list();

static int al_expmem()
{
  return 0;
}

static int pub_al(char *nick, char *host, char *hand, char *channel, char *text)
{
    dprintf(DP_HELP, "PRIVMSG %s :Test :: %s :: %s :: %s :: %s :: %s", nick, nick, host, hand, channel, text);
    do_list(nick, text);
    return 0;
}

static int msg_al(char *nick, char *host, struct userrec *u, char *text)
{
    dprintf(DP_SERVER, "PRIVMSG %s : Test :: %s :: %s :: %s", nick, nick, host, text);
    do_list(nick, text);
    return 0;
}

static void do_list(char *nick, char *text)
{
    dprintf(DP_SERVER, "PRIVMSG %s : Test :: %s :: %s", nick, nick, text);


/*
 * SQL stuff start
 */
 
    MYSQL *conn;
    MYSQL_RES *res;
    MYSQL_ROW row;

    char *server = "localhost";
    char *user = "eggdrop-xxxx";
    char *password = "xxxxxxx"; /* set me first */
    char *database = "eggdrop_al";

    conn = mysql_init(NULL);

    /* Connect to database */
    if (!mysql_real_connect(conn, server, user, password, database, 0, NULL, 0)) {
   dprintf(DP_SERVER, "PRIVMSG %s : There was an error of some kind please report to an owner: %s\n", nick, mysql_error(conn));
   exit(1);
    }

    /* send SQL query */
    if (mysql_query(conn, "SELECT * FROM `eggdrop_al`.`denylist`")) {
   dprintf(DP_SERVER, "PRIVMSG %s : There was an error of some kind please report to an owner: %s\n", nick, mysql_error(conn));
   exit(1);
    }

    res = mysql_use_result(conn);

    /* output table name */
   dprintf(DP_SERVER, "PRIVMSG %s :id :: nick :: date :: reason :: by:\n");
    while ((row = mysql_fetch_row(res)) != NULL)
   dprintf(DP_SERVER, "PRIVMSG %s :%s  %s  %s  %s  %s\n", nick, row[0], row[1], row[2], row[3], row[4]);

    /* close connection */
    mysql_free_result(res);
    mysql_close(conn);



 
/*
 * SQL stuff end
 */
}

static cmd_t al_pub[] = {
  /* command  flags  function     tcl-name */
  {"!list", "", pub_al, NULL},
  {NULL, NULL, NULL, NULL}  /* Mark end. */
};

static cmd_t al_msg[] = {
  {"!list", "", msg_al, NULL},
  {NULL, NULL, NULL, NULL}
};

static void al_report(int idx, int details)
{
  if (details) {
    int size = al_expmem();

    dprintf(idx, "    Using %d byte%s of memory\n", size,
            (size != 1) ? "s" : "");
  }
}

static char *al_close()
{
  //Context;
    p_tcl_bind_list H_temp;
   
    if ((H_temp = find_bind_table("pub")))
   rem_builtins(H_temp, al_pub);
    if ((H_temp = find_bind_table("msg")))
   rem_builtins(H_temp, al_msg);
 
  module_undepend(MODULE_NAME);
  return NULL;
}

EXPORT_SCOPE char *al_start();

static Function al_table[] = {
  (Function) al_start,
  (Function) al_close,
  (Function) al_expmem,
  (Function) al_report,
};


char *al_start(Function *global_funcs)
{
  /* Assign the core function table. After this point you use all normal
   * functions defined in src/mod/modules.h
   */
  global = global_funcs;

  Context;
  /* Register the module. */
  module_register(MODULE_NAME, al_table, 1, 0);

  if (!module_depend(MODULE_NAME, "eggdrop", 106, 0)) {
    module_undepend(MODULE_NAME);
    return "This module requires Eggdrop 1.6.0 or later.";
  }

    p_tcl_bind_list H_temp;

    if ((H_temp = find_bind_table("msg")))
   add_builtins(H_temp, al_msg);
    if ((H_temp = find_bind_table("pub")))
   add_builtins(H_temp, al_pub);

  return NULL;
}

Back to top
View user's profile Send private message
mayatekla
Voice


Joined: 08 Sep 2008
Posts: 3

PostPosted: Tue Sep 09, 2008 4:18 pm    Post subject: Reply with quote

[solved]

It seems list_delete is defined in eggdrops users.h as well as mysql's my_list.h

so for a nice solution:

Code:

#define MODULE_NAME "al"
#define MAKING_AL

#define list_delete egg_list_delete
#include "src/mod/module.h"
#undef list_delete

#include <mysql.h>


reorganisation of the includes, redefine eggdrops list_delete to egg_list_delete then undef list_delete before including mysql.h


Evil things like this give me headaches
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Modules & Programming All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber