Siaon Posted April 10, 2004 Report Posted April 10, 2004 Replace in aliasdb.c local helptext_t qip_help = "Targets: none or player\n" "Args: -i<ip address or pattern> -l<limit>\n" "Queries the alias database for players connecting from that ip.\n" "Queries can be an exact address, ?qip -i216.34.65.%, or ?qip -i216.34.65.0/24.\n"; local void Cqip(const char *params, Player *p, const Target *target) {   char ip [256];   unsigned int limit;   if (target->type != T_ARENA && target->type != T_PLAYER)     return;   if (!strstr(params,"-i") && target->type != T_PLAYER)     return;   p->flags.during_query = 1;   if (strstr(params,"-l"))   {     limit = atoi(strstr(params,"-l")+2);     if ( limit < 1 )       limit = 1;     if ( limit > 500 )       limit = 500;   } else   {     limit = 50;   }   if (target->type == T_PLAYER)   {     db->Query(dbcb_nameipmac, p, 1,       "select name, inet_ntoa(ip), macid, to_days(now()) - to_days(lastseen) as daysago "       "from " TABLE_NAME " "       "where ip = inet_aton(?) "       "order by name "       "limit # ",       target->u.p->ipaddr, limit);   }   else   {     if (strchr(strstr(params,"-i")+2, ' '))     {       ip [strchr(strstr(params,"-i")+2, ' ')-params-2] = 0;       strncpy ( ip, strstr(params,"-i")+2, strchr(strstr(params,"-i")+2, ' ')-params-2);     }     else     {       strcpy ( ip, strstr(params,"-i")+2);     }     if (strchr(params, '/'))     {       char baseip[16];       const char *next;       unsigned int bits;       next = delimcpy(baseip, ip, sizeof(baseip), '/');       if (!next) return;       bits = atoi(next);       db->Query(dbcb_nameipmac, p, 1,         "select name, inet_ntoa(ip), macid, to_days(now()) - to_days(lastseen) as daysago "         "from " TABLE_NAME " "         "where (ip & ((~0) << (32-#))) = (inet_aton(?) & ((~0) << (32-#))) "         "order by name "         "limit # ",         bits, baseip, bits, limit);     }     else if (strchr(ip, '%'))     {       /* this is going to be a really really slow query... */       db->Query(dbcb_nameipmac, p, 1,         "select name, inet_ntoa(ip), macid, to_days(now()) - to_days(lastseen) as daysago "         "from " TABLE_NAME " "         "where inet_ntoa(ip) like ? "         "order by name "         "limit #",         ip, limit);     }     else /* try exact ip match */     {       db->Query(dbcb_nameipmac, p, 1,         "select name, inet_ntoa(ip), macid, to_days(now()) - to_days(lastseen) as daysago "         "from " TABLE_NAME " "         "where ip = inet_aton(?) "         "order by name "         "limit # ",         ip, limit);     }   } } http://members.home.nl/siaon/CrossFire%20Logo%203.jpg (Some of the conversation had to be cut away, it was just too...)NiKe G u R L 637> hmmm... your pants aren't right >.>picano2.0> umm... good or bad thing?...NiKe G u R L 637> yay i finished pic...NiKe G u R L 637> are you ready pic?!...NiKe G u R L 637> ohh picano?...NiKe G u R L 637> oh picano...NiKe G u R L 637> picanooo
★ i88gerbils Posted April 10, 2004 Report Posted April 10, 2004 It would probably be better to attach a patchfile using diff instead of pasting the code for copy/paste people. http://forums.minegoboom.com will probably get more recognizition too.
Siaon Posted April 10, 2004 Author Report Posted April 10, 2004 True, but haven't worked with patchfiles before, anyway I've also send it to Grel, so if the general consensus is that this in indeed an improvement over the old ?qip then it will be in the public dist anyway. http://members.home.nl/siaon/CrossFire%20Logo%203.jpg (Some of the conversation had to be cut away, it was just too...)NiKe G u R L 637> hmmm... your pants aren't right >.>picano2.0> umm... good or bad thing?...NiKe G u R L 637> yay i finished pic...NiKe G u R L 637> are you ready pic?!...NiKe G u R L 637> ohh picano?...NiKe G u R L 637> oh picano...NiKe G u R L 637> picanooo
Siaon Posted April 11, 2004 Author Report Posted April 11, 2004 The only problem is that there is no real convention on how ASSS command parameters should look, and because I do think there needs to be a certain consistency, ah well, we'll see what I come up with, ?rawquery is next http://members.home.nl/siaon/CrossFire%20Logo%203.jpg (Some of the conversation had to be cut away, it was just too...)NiKe G u R L 637> hmmm... your pants aren't right >.>picano2.0> umm... good or bad thing?...NiKe G u R L 637> yay i finished pic...NiKe G u R L 637> are you ready pic?!...NiKe G u R L 637> ohh picano?...NiKe G u R L 637> oh picano...NiKe G u R L 637> picanooo
★ CypherJF Posted April 12, 2004 Report Posted April 12, 2004 this isnt part of game development i believe, rather server -- should be on mine go boom's forums Owner/Operator of Omega Fire
Recommended Posts