collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Fetch whois on the fly?  (Read 1950 times)

0 Members and 3 Guests are viewing this topic.

Offline Dochere

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
Fetch whois on the fly?
« on: September 07, 2009, 09:46:37 am »
Hey,


Im currently working on a registrar function, but i have a problem, im unable to fetch user data "on the fly", as of now all users who wants to register and are "new" to the bot (never spoken to the bot) have to send the tell 2 times. Cause first time the wrong data is stored. (i use preferences to determine if user should become Member or guest)

What i do atm is call user lookup and update upon every tell as i want the whois table to be up to date every time a user uses the register command.


Code: [Select]

function command_handler($name, $msg, $type) {

$a = $this -> bot -> core("whois") -> lookup($name, TRUE); //Lets fetch user data every time a user sends a tell. We want user data to be acurate.
if ($this -> bot -> core("whois") -> update($a)) { //Incase we need to add error handling.
//User data fetched.
} else {
//Error fetching user data.
}

return $this -> register_account($name, $msg, $type);
}



Then inside my register_account function i call the lookup once more to fetch the data i should have just updated in the com handler. Please help  ???


All feedback appreciated :)

Offline Dochere

  • BeBot User
  • **
  • Posts: 43
  • Karma: +0/-0
Re: Fetch whois on the fly?
« Reply #1 on: September 07, 2009, 09:54:29 am »
Found the error, cause of poor description "lookup($name, TRUE)" means do not update cache. Logically for me that would mean "TRUE will update cache" and "FALSE do not update cache". But yeah its working now.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Fetch whois on the fly?
« Reply #2 on: September 07, 2009, 02:18:54 pm »
I think the description is fairly telling tbh.
Code: [Select]
function lookup($name, $noupdate=false)

If you don't know what the boolean switch you are sending does... don't assume it does what you guess it to do.

iow. If you want to lookup someones info  lookup($name);

If you want to lookup someones data, but do not want to cause any delays and can live with not updating the information if it has become stale, lookup($name, TRUE);
BeBot Founder and Fixer Kingpin

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 216
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal