Permalink
Browse files

Standard PEAR/Zend style methods

  • Loading branch information...
1 parent e189dc5 commit 2f091d5eb0804ff09957624edb4854df47610e74 @ceefour committed Sep 28, 2010
Showing with 22 additions and 22 deletions.
  1. +10 −10 client.php
  2. +12 −12 jymengine.class.php
View
@@ -37,26 +37,26 @@
$engine->debug = false;
if ($engine->debug) echo '> Fetching request token'. PHP_EOL;
-if (!$engine->fetch_request_token()) die('Fetching request token failed');
+if (!$engine->fetchRequestToken()) die('Fetching request token failed');
if ($engine->debug) echo '> Fetching access token'. PHP_EOL;
-if (!$engine->fetch_access_token()) die('Fetching access token failed');
+if (!$engine->fetchAccessToken()) die('Fetching access token failed');
if ($engine->debug) echo '> Signon as: '. USERNAME. PHP_EOL;
if (!$engine->signon('I am login from PHP code')) die('Signon failed');
$seq = -1;
while (true)
{
- $resp = $engine->fetch_long_notification($seq+1);
+ $resp = $engine->fetchLongNotification($seq+1);
if (isset($resp))
{
if ($resp === false)
{
- if ($engine->get_error() != -10)
+ if ($engine->getError() != -10)
{
if ($engine->debug) echo '> Fetching access token'. PHP_EOL;
- if (!$engine->fetch_access_token()) die('Fetching access token failed');
+ if (!$engine->fetchAccessToken()) die('Fetching access token failed');
if ($engine->debug) echo '> Signon as: '. USERNAME. PHP_EOL;
if (!$engine->signon(date('H:i:s'))) die('Signon failed');
@@ -133,7 +133,7 @@
}
else if ($words[0] == 'status')
{
- $engine->change_presence(str_replace('status ', '', strtolower($val['msg'])));
+ $engine->changePresence(str_replace('status ', '', strtolower($val['msg'])));
$out = 'My status is changed';
}
else
@@ -145,17 +145,17 @@
if ($engine->debug) echo '> Sending reply message '. PHP_EOL;
if ($engine->debug) echo ' '. $out. PHP_EOL;
if ($engine->debug) echo '----------'. PHP_EOL;
- $engine->send_message($val['sender'], json_encode($out));
+ $engine->sendMessage($val['sender'], json_encode($out));
}
else if ($key == 'buddyAuthorize') //incoming contact request
{
if ($engine->debug) echo PHP_EOL. 'Accept buddy request from: '. $val['sender']. PHP_EOL;
if ($engine->debug) echo '----------'. PHP_EOL;
- if (!$engine->response_contact($val['sender'], true, 'Welcome to my list'))
+ if (!$engine->responseContact($val['sender'], true, 'Welcome to my list'))
{
- $engine->delete_contact($val['sender']);
- $engine->response_contact($val['sender'], true, 'Welcome to my list');
+ $engine->deleteContact($val['sender']);
+ $engine->responseContact($val['sender'], true, 'Welcome to my list');
}
}
}
View
@@ -63,7 +63,7 @@ public function __construct($consumer_key = '', $secret_key = '', $username = ''
$this->_error = null;
}
- public function fetch_request_token()
+ public function fetchRequestToken()
{
//prepare url
$url = $this::URL_OAUTH_DIRECT;
@@ -79,7 +79,7 @@ public function fetch_request_token()
return true;
}
- public function fetch_access_token()
+ public function fetchAccessToken()
{
//prepare url
$url = $this::URL_OAUTH_ACCESS_TOKEN;
@@ -111,7 +111,7 @@ public function fetch_access_token()
return true;
}
- public function fetch_crumb()
+ public function fetchCrumb()
{
//prepare url
$url = $this::URL_YM_SESSION;
@@ -190,7 +190,7 @@ public function signoff()
return true;
}
- public function change_presence($status = '', $state = 0)
+ public function changePresence($status = '', $state = 0)
{
//prepare url
$url = $this::URL_YM_PRESENCE;
@@ -211,7 +211,7 @@ public function change_presence($status = '', $state = 0)
return true;
}
- public function send_message($user, $message)
+ public function sendMessage($user, $message)
{
//prepare url
$url = $this::URL_YM_MESSAGE;
@@ -234,7 +234,7 @@ public function send_message($user, $message)
return true;
}
- public function fetch_contact_list()
+ public function fetchContactList()
{
//prepare url
$url = $this::URL_YM_CONTACT;
@@ -260,7 +260,7 @@ public function fetch_contact_list()
return $js['contacts'];
}
- public function add_contact($user, $group = 'Friends', $message = '')
+ public function addContact($user, $group = 'Friends', $message = '')
{
//prepare url
$url = $this::URL_YM_GROUP;
@@ -283,7 +283,7 @@ public function add_contact($user, $group = 'Friends', $message = '')
return true;
}
- public function delete_contact($user, $group = 'Friends')
+ public function deleteContact($user, $group = 'Friends')
{
//prepare url
$url = $this::URL_YM_GROUP;
@@ -305,7 +305,7 @@ public function delete_contact($user, $group = 'Friends')
return true;
}
- public function response_contact($user, $accept = true, $message = '')
+ public function responseContact($user, $accept = true, $message = '')
{
if ($accept)
{
@@ -359,7 +359,7 @@ public function response_contact($user, $accept = true, $message = '')
return true;
}
- public function fetch_notification($seq = 0)
+ public function fetchNotification($seq = 0)
{
//prepare url
$url = $this::URL_YM_NOTIFICATION;
@@ -393,7 +393,7 @@ public function fetch_notification($seq = 0)
return $js['responses'];
}
- public function fetch_long_notification($seq = 0)
+ public function fetchLongNotification($seq = 0)
{
//prepare url
$url = $this::URL_YM_NOTIFICATION_LONG;
@@ -524,7 +524,7 @@ private function curl($url, $method = 'get', $header = null, $postdata = null, $
return $html;
}
- public function get_error()
+ public function getError()
{
return $this->_error;
}

0 comments on commit 2f091d5

Please sign in to comment.