Permalink
Browse files

Remove Facebook chat support

Facebook chat related code is broken since 2011 due to the Facebook
platform changes (see
https://developers.facebook.com/blog/post/2011/09/09/platform-updates--operation-developer-love/
for details). Several attempts were made to update the code but with
no luck. If anyone wishes to fix this code then feel free to send pull
request.
  • Loading branch information...
rraptorr committed Oct 17, 2013
1 parent 722f45d commit e54b5d1a8469721d7fbb84652492d15edd7f235d
View
@@ -6,15 +6,13 @@ src/JSJaCBuilder.js src/JSJaCConstants.js \
src/JSJaCConsoleLogger.js src/JSJaCCookie.js src/JSJaCError.js \
src/JSJaCJID.js src/JSJaCKeys.js src/JSJaCPacket.js src/JSJaCConnection.js \
src/JSJaCHttpBindingConnection.js src/JSJaCWebSocketConnection.js \
-src/JSJaCFBApplication.js \
src/JSJaC.js
POLLING_SRC=src/jsextras.js src/crypt.js src/JSJaCJSON.js src/xmlextras.js \
src/JSJaCBuilder.js src/JSJaCConstants.js \
src/JSJaCConsoleLogger.js src/JSJaCCookie.js src/JSJaCError.js \
src/JSJaCJID.js src/JSJaCKeys.js src/JSJaCPacket.js src/JSJaCConnection.js \
src/JSJaCHttpPollingConnection.js \
-src/JSJaCFBApplication.js \
src/JSJaC.js
all: clean utils install doc
@@ -1,355 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>JSJaC Simple Facebook Chat Client | SIMACS of Andrea Cammarata</title>
-
- <script type="text/javascript" src="../jsjac.js"></script>
-
- <script src="http://connect.facebook.net/en_US/all.js"></script>
-
- <!-- comment in above and uncomment below if you want to modify/hack
- on jsjac -->
- <!--script type="text/javascript" src="../src/JSJaC.js"></script-->
-
- <!-- if you want to enable debugging uncomment line below
- debugger available at
- http://svn.stefan-strigler.de/JSDebugger/trunk -->
- <!--script type="text/javascript" src="Debugger.js"></script-->
-
- <script language="JavaScript" type="text/javascript">
- // <![CDATA[
-
- function doLogin(aForm) {
-
- /* Setting the Facebook app configuration parameters.
- * You can get this params inside your app configuration
- * page at the facebook developers apps section:
- * http://www.facebook.com/developers/apps.php */
- var fbArg = {
-
- //Set the application ID
- appID: aForm.applicationID.value,
-
- //Set the application API Key
- apiKey: aForm.apiKey.value,
-
- //Set the application API Secret
- apiSecret: aForm.apiSecret.value
-
- };
-
- //Creation of the Facebook Application
- var app = new JSJaCFBApplication(fbArg);
-
- //Setting the jabber connection configurations
- var oArgs = {
-
- //Set the http-binding address
- httpbase: aForm.http_base.value,
-
- //Set the Timerval
- timerval: 2000
-
- };
-
- //Creation of the jabber connection object
- if (aForm.backend[0].checked){
- con = new JSJaCHttpBindingConnection(oArgs);
- }else{
- con = new JSJaCHttpPollingConnection(oArgs);
- }
-
- //Calling the connection setup function
- setupCon(con);
-
- /* Setting the connection authType and the Facebook app configuration
- * that will be used to allow the user login inside the appication
- * and start to chat with his friends */
- var conArgs = {
-
- //Setting the authorization type to "x-facebook-platform"
- authtype: 'x-facebook-platform',
-
- //Setting the Facebook Application configuration
- facebookApp: app
-
- };
-
- //Let's connect to Facebook server
- con.connect(conArgs);
-
- return false;
- }
-
- function handleIQ(aIQ) {
-
- document.getElementById('iResp').innerHTML +=
- "<div class='msg'>IN (raw): " +aIQ.xml().htmlEnc() + '</div>';
- document.getElementById('iResp').lastChild.scrollIntoView();
- con.send(aIQ.errorReply(ERR_FEATURE_NOT_IMPLEMENTED));
-
- }
-
- function handleMessage(aJSJaCPacket) {
-
- var html = '';
- html += '<div class="msg"><b>Received Message from '+aJSJaCPacket.getFromJID()+':</b><br/>';
- html += aJSJaCPacket.getBody().htmlEnc() + '</div>';
- document.getElementById('iResp').innerHTML += html;
- document.getElementById('iResp').lastChild.scrollIntoView();
-
- }
-
- function handlePresence(aJSJaCPacket) {
-
- var html = '<div class="msg">';
- if (!aJSJaCPacket.getType() && !aJSJaCPacket.getShow())
- html += '<b>'+aJSJaCPacket.getFromJID()+' has become available.</b>';
- else {
- html += '<b>'+aJSJaCPacket.getFromJID()+' has set his presence to ';
- if (aJSJaCPacket.getType())
- html += aJSJaCPacket.getType() + '.</b>';
- else
- html += aJSJaCPacket.getShow() + '.</b>';
- if (aJSJaCPacket.getStatus())
- html += ' ('+aJSJaCPacket.getStatus().htmlEnc()+')';
- }
- html += '</div>';
-
- document.getElementById('iResp').innerHTML += html;
- document.getElementById('iResp').lastChild.scrollIntoView();
-
- }
-
- function handleError(e) {
-
- document.getElementById('err').innerHTML = "An error occured:<br />"+
- ("Code: "+e.getAttribute('code')+"\nType: "+e.getAttribute('type')+
- "\nCondition: "+e.firstChild.nodeName).htmlEnc();
- document.getElementById('login_pane').style.display = '';
- document.getElementById('sendmsg_pane').style.display = 'none';
-
- if (con.connected())
- con.disconnect();
-
- }
-
- function handleStatusChanged(status) {
-
- oDbg.log("status changed: "+status);
-
- }
-
- function handleConnected() {
-
- document.getElementById('login_pane').style.display = 'none';
- document.getElementById('sendmsg_pane').style.display = '';
- document.getElementById('err').innerHTML = '';
-
- con.send(new JSJaCPresence());
-
- }
-
- function handleDisconnected() {
-
- document.getElementById('login_pane').style.display = '';
- document.getElementById('sendmsg_pane').style.display = 'none';
-
- }
-
- function handleIqVersion(iq) {
-
- con.send(iq.reply([
- iq.buildNode('name', 'jsjac simpleclient'),
- iq.buildNode('version', JSJaC.Version),
- iq.buildNode('os', navigator.userAgent)
- ]));
- return true;
-
- }
-
- function handleIqTime(iq) {
-
- var now = new Date();
- con.send(iq.reply([iq.buildNode('display',
- now.toLocaleString()),
- iq.buildNode('utc',
- now.jabberDate()),
- iq.buildNode('tz',
- now.toLocaleString().substring(now.toLocaleString().lastIndexOf(' ')+1))
- ]));
- return true;
-
- }
-
- function setupCon(con) {
-
- con.registerHandler('message',handleMessage);
- con.registerHandler('presence',handlePresence);
- con.registerHandler('iq',handleIQ);
- con.registerHandler('onconnect',handleConnected);
- con.registerHandler('onerror',handleError);
- con.registerHandler('status_changed',handleStatusChanged);
- con.registerHandler('ondisconnect',handleDisconnected);
-
- con.registerIQGet('query', NS_VERSION, handleIqVersion);
- con.registerIQGet('query', NS_TIME, handleIqTime);
-
- }
-
- function sendMsg(aForm) {
-
- if (aForm.msg.value == '' || aForm.sendTo.value == '')
- return false;
-
- if (aForm.sendTo.value.indexOf('@') == -1)
- aForm.sendTo.value += '@' + con.domain;
-
- try {
- var aMsg = new JSJaCMessage();
- aMsg.setTo(new JSJaCJID(aForm.sendTo.value));
- aMsg.setBody(aForm.msg.value);
- con.send(aMsg);
-
- aForm.msg.value = '';
-
- return false;
- } catch (e) {
- html = "<div class='msg error''>Error: "+e.message+"</div>";
- document.getElementById('iResp').innerHTML += html;
- document.getElementById('iResp').lastChild.scrollIntoView();
- return false;
- }
-
- }
-
- function quit() {
-
- var p = new JSJaCPresence();
- p.setType("unavailable");
- con.send(p);
- con.disconnect();
-
- document.getElementById('login_pane').style.display = '';
- document.getElementById('sendmsg_pane').style.display = 'none';
-
- }
-
- function init() {
-
- if (typeof(Debugger) == 'function') {
- oDbg = new Debugger(2,'facebookclient');
- oDbg.start();
- } else {
- // if you're using firebug or safari, use this for debugging
- //oDbg = new JSJaCConsoleLogger(2);
- // comment in above and remove comments below if you don't need debugging
- oDbg = function() {};
- oDbg.log = function() {};
- }
-
- }
-
- onload = init;
-
- onerror = function(e) {
- document.getElementById('err').innerHTML = e;
-
- document.getElementById('login_pane').style.display = '';
- document.getElementById('sendmsg_pane').style.display = 'none';
-
- if (con && con.connected()){
- con.disconnect();
- return false;
- }
- };
-
- // ]]>
- </script>
-
- <style type="text/css">
-
- /*<![CDATA[*/
- body {
- font-family: "Bitstream Vera Sans", "Verdana", sans;
- font-size: 0.8em;
- margin: 12px;
- }
- h2 {
- border-bottom: 1px solid grey;
- }
- input {
- border: 1px solid grey;
- }
- #apiKey, #apiSecret {
- width: 230px;
- }
- #iResp {
- width: 420px;
- height: 260px;
- overflow: auto;
- border: 2px dashed grey;
- padding: 4px;
- }
- #msgArea {
- width: 420px;
- height: 45px;
- padding: 4px;
- margin: 0;
- border: 2px dashed grey;
- }
- .spaced {
- margin-bottom: 4px;
- }
- .msg {
- border-bottom: 1px solid black;
- }
- .error {
- font-weight: bold;
- color: red;
- }
- /*]]>*/
-
- </style>
-
- </head>
- <body>
-
-
- <h1><a href="#" onclick="location.reload();">JSJaC Simple Facebook Chat Client</a></h1>
-
- <div id="err"></div>
-
- <div id="login_pane">
- <h2>Login</h2>
- <form name="loginForm" onSubmit="return doLogin(this);" action="#">
- <table>
-
- <tr><th>Backend Type</th><td><input type="radio" name="backend" value="binding" id="backend1" tabindex="1" checked /> <label for="backend1">HTTP Binding</label><br /> <input type="radio" name="backend" value="polling" id="backend2" tabindex="2"/> <label for="backend2">HTTP Polling</label></td></tr>
- <tr><th><label for="http_base">HTTP Base</label></th><td><input type="text" name="http_base" id="http_base" tabindex="3"/></td></tr>
- <tr><th colspan="2"><hr noshade size="1"/></th></tr>
- <tr><td colspan="2"><b>Facebook application configuration:</b></td></tr>
- <tr><th><label for="server">Application ID</label></th><td><input type="text" name="applicationID" id="applicationID" tabindex="4" /></td></tr>
- <tr><th><label for="username">Api Key</label></th><td><input type="text" name="apiKey" id="apiKey" tabindex="5" /></td></tr>
- <tr><th><label for="password">Api Secret</label></th><td><input type="text" name="apiSecret" id="apiSecret" tabindex="6" /></td></tr>
-
- <tr><td>&nbsp;</td><td><input type="submit" value="Login" tabindex="4"></td></tr>
-
- </table>
- </form>
- </div>
-
- <div id="sendmsg_pane" style="display:none;">
- <h2>Incoming:</h2>
- <div id="iResp"></div>
- <h2>Send Message</h2>
- <form name="sendForm" onSubmit="return sendMsg(this);" action="#">
- <div class="spaced"><b>To:</b> <input type="text" name="sendTo" tabindex="1"></div>
- <div class="spaced"><textarea name="msg" id='msgArea' rows="3" cols="80" tabindex="2"></textarea></div>
- <div class="spaced"><input type="submit" value="Send" tabindex="3"> * <input type="button" value="Quit" tabindex="4" onclick="return quit();"></div>
- </form>
- </div>
-
- </body>
-</html>
View
@@ -28,7 +28,6 @@ var JSJaC = {
'JSJaCHttpPollingConnection',
'JSJaCHttpBindingConnection',
'JSJaCConsoleLogger',
- 'JSJaCFBApplication',
'JSJaCWebSocketConnection'
];
var scripts = document.getElementsByTagName("script");
Oops, something went wrong.

0 comments on commit e54b5d1

Please sign in to comment.