Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: bs_quotes - Possible new features and improvment  (Read 2881 times)

0 Members and 1 Guest are viewing this topic.

CrazyCat

  • Anope User
  • Offline Offline
  • Posts: 176
    • French Eggdrop community
bs_quotes - Possible new features and improvment
« on: December 15, 2011, 10:48:52 AM »

Hello there,

I've a few idea about bs_quotes and I need your feedback before beginning develop them:
  • Having MySQL config optional, using the main Anope MySQL config as default.
  • Allow to change the level to add a quote via a in-code config.
  • Limit the random display to the quotes from the channel.
  • Allow to display (or not) the infos about the quote.
  • Your ideas ?

CrazyCat

  • Anope User
  • Offline Offline
  • Posts: 176
    • French Eggdrop community
Re: bs_quotes - Possible new features and improvment
« Reply #1 on: January 25, 2012, 09:14:49 PM »

Hello there,

I'm a really beginner in C and I've a small question for you.
I want, as said in my previous post, make the mysql config optional. So, the wanted working might be: if QuoteMySQLHost isn't defined in config, use MySQLHost. And if it isn't defined, return error.

What I did:
Code: [Select]
char *Q_MYSQL_HOST = NULL;
/* ... now in load_config, called by AnopeInit */
Directive confvalues[][1] = {
    {{ "QuoteMySQLHost",       { { PARAM_STRING, PARAM_RELOAD, &Q_MYSQL_HOST       } } }},
    {{ "QuoteMySQLPort",       { { PARAM_PORT,   PARAM_RELOAD, &Q_MYSQL_PORT       } } }},
    {{ "QuoteMySQLSocket",     { { PARAM_STRING, PARAM_RELOAD, &Q_MYSQL_SOCK       } } }},
    {{ "QuoteMySQLUser",       { { PARAM_STRING, PARAM_RELOAD, &Q_MYSQL_USER       } } }},
    {{ "QuoteMySQLPassword",   { { PARAM_STRING, PARAM_RELOAD, &Q_MYSQL_PASS       } } }},
    {{ "QuoteMySQLDatabase",   { { PARAM_STRING, PARAM_RELOAD, &Q_MYSQL_DB         } } }},
    {{ "QuoteEnableMultiLine", { { PARAM_SET,    PARAM_RELOAD, &Q_ENABLE_MULTILINE } } }},
    {{ "QuoteMySQLTable",      { { PARAM_STRING, PARAM_RELOAD, &Q_MYSQL_TABLE      } } }}
  };

   /* Setting of MySQLHost */
  moduleGetConfigDirective(confvalues[0]);
  if (!Q_MYSQL_HOST) {
     Directive confvalues[0][1] = {
      {{ "MySQLHost",       { { PARAM_STRING, PARAM_RELOAD, &Q_MYSQL_HOST       } } }}
     };
     moduleGetConfigDirective(confvalues[0]);
     if (!Q_MYSQL_HOST) { alog("[\002bs_quotes\002]: Missing config options!"); return MOD_STOP; }
  }
  /* Will be done for sock, user, pass, db */

I wonder there is a better way to do this, so I ask you : wich ?
Thanks a lot !
« Last Edit: January 25, 2012, 09:45:40 PM by CrazyCat »
Logged
Pages: [1]   Go Up