View Single Post
  #1   Spotlight this post!  
Unread 05-07-2005, 23:46
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Re: libgmailer experience?

Quote:
Originally Posted by MrToast
Code:
function getInfo() {
	$snapshot = $this->getSnapshot(GM_STANDARD);
	$info = array();
	if ($snapshot) {
		$info["quota"]["MB"] = $snapshot->quota_mb;
		$info["quota"]["Percentage"] = $snapshot->quota_per;
		$info["invitations"] = $snapshot->have_invit;
		$info["labels"] = $snapshot->label_list;
		$info["total"] = $snapshot->box_total;
	}
	return $info;
}
When you call getSnapshot, your only have the $type parameter set (GM_STANDARD), but in the class GMailSnapshot constructor it also has a $raw parameter. There is an if statement which decides whether or not to set $this->have_invit;
Code:
if (isset($raw["i"][1])) $this->have_invit = $raw["i"][1];
But, $raw isn't set. Maybe try something like
Code:
function getInfo() {
	$raw = array(
		  "i" => array(TRUE),
		  "gn" => array(TRUE),
		  "v" => array(TRUE)
		);
	$snapshot = $this->getSnapshot(GM_STANDARD);
	$info = array();
	if ($snapshot) {
		$info["quota"]["MB"] = $snapshot->quota_mb;
		$info["quota"]["Percentage"] = $snapshot->quota_per;
		$info["invitations"] = $snapshot->have_invit;
		$info["labels"] = $snapshot->label_list;
		$info["total"] = $snapshot->box_total;
	}
	return $info;
}
That array setup may be fubar, as I've never dealt with multi-dimensional arrays in this sense...

EDIT (Again): Just looked over the code, and $this->have_invit is set from the array put in as a parameter, so I don't think you can get the amount of invites from calling this function =(

Maybe some creative use of sockets and regular expression functions would let you parse the info out?

__________________
http://www.mikesorrenti.com/

Last edited by Mike : 05-07-2005 at 23:55.
Reply With Quote