home *** CD-ROM | disk | FTP | other *** search
/ Computer Active 2010 August / CA08.iso / Multimedija / shufflr.air / ShufflrClient.swf / scripts / com / facebook / session / WebSession.as < prev   
Encoding:
Text File  |  2010-06-23  |  4.0 KB  |  152 lines

  1. package com.facebook.session
  2. {
  3.    import com.facebook.delegates.IFacebookCallDelegate;
  4.    import com.facebook.delegates.VideoUploadDelegate;
  5.    import com.facebook.delegates.WebDelegate;
  6.    import com.facebook.delegates.WebImageUploadDelegate;
  7.    import com.facebook.events.FacebookEvent;
  8.    import com.facebook.facebook_internal;
  9.    import com.facebook.net.FacebookCall;
  10.    import com.facebook.net.IUploadPhoto;
  11.    import com.facebook.net.IUploadVideo;
  12.    import flash.events.EventDispatcher;
  13.    
  14.    use namespace facebook_internal;
  15.    
  16.    public class WebSession extends EventDispatcher implements IFacebookSession
  17.    {
  18.       public static const REST_URL:String = "http://api.facebook.com/restserver.php";
  19.       
  20.       public static const VIDEO_URL:String = "http://api-video.facebook.com/restserver.php";
  21.       
  22.       facebook_internal var _uid:String;
  23.       
  24.       protected var _is_connected:Boolean = false;
  25.       
  26.       public var login_url:String = "http://www.facebook.com/login.php";
  27.       
  28.       protected var _secret:String;
  29.       
  30.       protected var _rest_url:String = "http://api.facebook.com/restserver.php";
  31.       
  32.       protected var _api_version:String = "1.0";
  33.       
  34.       protected var _expires:Date;
  35.       
  36.       protected var _session_key:String;
  37.       
  38.       protected var _api_key:String;
  39.       
  40.       public function WebSession(param1:String, param2:String, param3:String = null)
  41.       {
  42.          super();
  43.          this._api_key = param1;
  44.          this._session_key = param3;
  45.          this.secret = param2;
  46.       }
  47.       
  48.       public function get waiting_for_login() : Boolean
  49.       {
  50.          return false;
  51.       }
  52.       
  53.       public function get rest_url() : String
  54.       {
  55.          return this._rest_url;
  56.       }
  57.       
  58.       public function set rest_url(param1:String) : void
  59.       {
  60.          this._rest_url = param1;
  61.       }
  62.       
  63.       public function post(param1:FacebookCall) : IFacebookCallDelegate
  64.       {
  65.          this.rest_url = REST_URL;
  66.          if(param1 is IUploadPhoto)
  67.          {
  68.             return new WebImageUploadDelegate(param1,this);
  69.          }
  70.          if(param1 is IUploadVideo)
  71.          {
  72.             this.rest_url = VIDEO_URL;
  73.             return new VideoUploadDelegate(param1,this);
  74.          }
  75.          return new WebDelegate(param1,this);
  76.       }
  77.       
  78.       public function get secret() : String
  79.       {
  80.          return this._secret;
  81.       }
  82.       
  83.       public function get expires() : Date
  84.       {
  85.          return this._expires;
  86.       }
  87.       
  88.       public function get api_key() : String
  89.       {
  90.          return this._api_key;
  91.       }
  92.       
  93.       public function refreshSession() : void
  94.       {
  95.       }
  96.       
  97.       public function get session_key() : String
  98.       {
  99.          return this._session_key;
  100.       }
  101.       
  102.       public function get uid() : String
  103.       {
  104.          return facebook_internal::_uid;
  105.       }
  106.       
  107.       public function get api_version() : String
  108.       {
  109.          return this._api_version;
  110.       }
  111.       
  112.       public function get is_connected() : Boolean
  113.       {
  114.          return this._is_connected;
  115.       }
  116.       
  117.       public function set secret(param1:String) : void
  118.       {
  119.          this._secret = param1;
  120.       }
  121.       
  122.       public function verifySession() : void
  123.       {
  124.          if(this._session_key)
  125.          {
  126.             this._is_connected = true;
  127.             dispatchEvent(new FacebookEvent(FacebookEvent.CONNECT,false,false,true));
  128.          }
  129.          else
  130.          {
  131.             this._is_connected = false;
  132.             dispatchEvent(new FacebookEvent(FacebookEvent.CONNECT,false,false,false));
  133.          }
  134.       }
  135.       
  136.       public function set api_version(param1:String) : void
  137.       {
  138.          this._api_version = param1;
  139.       }
  140.       
  141.       public function login(param1:Boolean) : void
  142.       {
  143.       }
  144.       
  145.       public function set session_key(param1:String) : void
  146.       {
  147.          this._session_key = param1;
  148.       }
  149.    }
  150. }
  151.  
  152.