Skip to content

Commit

Permalink
Cleaned up licensing info
Browse files Browse the repository at this point in the history
  • Loading branch information
sebdeckers committed Dec 16, 2010
1 parent 97b6e3f commit c89cea1
Show file tree
Hide file tree
Showing 30 changed files with 73 additions and 185 deletions.
5 changes: 0 additions & 5 deletions app.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<!DOCTYPE html>
<!--
This file is part of Tribe.im
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
-->
<html x-manifest="app.manifest">
<head>
<meta charset="utf-8" />
Expand Down
7 changes: 1 addition & 6 deletions core/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(
define(
[
"libraries/polyfill",
"core/events",
Expand Down
7 changes: 1 addition & 6 deletions core/css.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(function () {
define(function () {
var baseTheme = "themes/base/";
var stylesheets = {};
return {
Expand Down
7 changes: 1 addition & 6 deletions core/events.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(function () {
define(function () {
var callbacks = {};

var iterators = (function () {
Expand Down
7 changes: 1 addition & 6 deletions core/loader.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(["core/events"], function (events) {
define(["core/events"], function (events) {
events.subscribe("xmpp.connected", function () {
require(["core/loaderList"], function (loaderList) {
require(loaderList, function (module) {
Expand Down
7 changes: 1 addition & 6 deletions core/loaderList.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(function () {return [
define(function () {return [
"modules/help",
"modules/search",
"modules/twitterSearch",
Expand Down
7 changes: 1 addition & 6 deletions core/paths.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(function () {
define(function () {
var pathHandlers = [];

var method = "fragment"; // "fragment" or "history"
Expand Down
7 changes: 1 addition & 6 deletions core/session.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(["core/events", "core/settings", "core/css"], function (events, settings, css) {
define(["core/events", "core/settings", "core/css"], function (events, settings, css) {
var $ = document.querySelector.bind(document);
var $$ = function () {return Array.prototype.slice.call(document.querySelectorAll.apply(document, arguments));};

Expand Down
7 changes: 1 addition & 6 deletions core/settings.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(["core/events"], function (events) {
define(["core/events"], function (events) {
var stubCopy = function (target, template) {
Object.keys(template).forEach(function (key) {
switch (typeof template[key]) {
Expand Down
7 changes: 1 addition & 6 deletions core/xmpp.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(["core/events", "core/xpath"], function (events, xpath) {
define(["core/events", "core/xpath"], function (events, xpath) {
/* Strophe instance */
var stropheConnection;

Expand Down
6 changes: 1 addition & 5 deletions core/xpath.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/*
Copyright (c) 2010 Sebastiaan Deckers
GNU General Public License version 3 or later
*/
/** Package: xpath
/** Package: xpath
* Easy to use API for XML traversal with XPath.
*
* Returns:
Expand Down
8 changes: 1 addition & 7 deletions libraries/HTMLElement.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/

// Making the HTMLElement.prototype writable in old Safari/KHTML.
// Making the HTMLElement.prototype writable in old Safari/KHTML.
// http://my.opera.com/_Grey_/blog/2007/04/21/safari-and-htmlelement-prototype
(function () {
var t, w = window;
Expand Down
7 changes: 1 addition & 6 deletions libraries/console.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
if (!("console" in window)) {
if (!("console" in window)) {
window.console = {};
}

Expand Down
7 changes: 1 addition & 6 deletions libraries/mustache.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(["libraries/mustache_.js"], function () {
define(["libraries/mustache_.js"], function () {
return Mustache;
});
7 changes: 1 addition & 6 deletions libraries/polyfill.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(
define(
[
"libraries/global-es5.js",
"libraries/split.js",
Expand Down
12 changes: 12 additions & 0 deletions license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
7 changes: 1 addition & 6 deletions modules/help.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(["core/ui"], function (ui) {
define(["core/ui"], function (ui) {
ui.addNavigation({
title: "Help",
url: "http://tribe.im/help"
Expand Down
7 changes: 1 addition & 6 deletions modules/jidParser.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(function () {
define(function () {
var cache = {};

// TODO: Implement Stringprep
Expand Down
62 changes: 35 additions & 27 deletions modules/roster.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
/*
Copyright (c) 2010 Sebastiaan Deckers
GNU General Public License version 3 or later
*/
/** Package: roster
/** Package: roster
* Parsing and eventing for the XMPP roster data.
*
* Returns:
* <RosterContacts>
*
* Event: contacts.change
* Event: roster.change
* One or more roster items have been updated.
*
* Payload:
* (RosterContacts) changedContacts - Contains <RosterContacts> that have been modified.
*
* Event: contacts.ready
* Event: roster.ready
* The roster has been loaded.
*
* Event: contacts.unavailable
* Event: roster.unavailable
* A contact goes offline or becomes otherwise unavailable. All its resources are disconnected.
*
* Payload:
Expand All @@ -26,7 +22,7 @@
* (String) resource - The resource of the contact.
* (Object) status - Contains the type and the resource's last message.
*
* Event: contacts.available
* Event: roster.available
* A contact's resource comes online or changes their availability.
*
* Payload:
Expand All @@ -35,21 +31,21 @@
* (String) resource - The resource of the contact.
* (RosterResource) rosterResource - The parsed <RosterResource> object.
*
* Event: contacts.subscribe
* Event: roster.subscribe
*
* Payload:
* (Element) presence - The <presence/> stanza.
* (String) jid - The bare address of the contact.
* (String) resource - The resource of the contact.
*
* Event: contacts.subscribed
* See: <contacts.subscribe>
* Event: roster.subscribed
* See: <roster.subscribe>
*
* Event: contacts.unsubscribe
* See: <contacts.subscribe>
* Event: roster.unsubscribe
* See: <roster.subscribe>
*
* Event: contacts.unsubscribed
* See: <contacts.subscribe>
* Event: roster.unsubscribed
* See: <roster.subscribe>
*/
define(
["core/events", "core/xmpp", "core/xpath", "modules/rosterCache", "modules/jidParser"],
Expand Down Expand Up @@ -120,19 +116,21 @@ function (events, xmpp, xpath, rosterCache, jidParser) {
}
xmpp.sendIQ(iq, function (iq) {
var oldContacts = roster.contacts;
var newRoster;
if (versioningSupported && !xpath(iq, "/client:iq/roster:query", Object, xmlns)) {
roster = rosterCache.load(xmpp.connection.jid.bare);
newRoster = rosterCache.load(xmpp.connection.jid.bare);
} else {
roster = parseRosterIQ(iq).roster;
rosterCache.save(xmpp.connection.jid.bare, roster);
newRoster = parseRosterIQ(iq).roster;
rosterCache.save(xmpp.connection.jid.bare, newRoster);
}
var changedContacts = compareContacts(oldContacts, roster.contacts);
var changedContacts = compareContacts(oldContacts, newRoster.contacts);
mergeRoster(roster, newRoster);
if (Object.keys(changedContacts).length > 0) {
events.publish("contacts.change", changedContacts);
events.publish("roster.change", changedContacts);
}
xmpp.subscribe(rosterIQHandler);
xmpp.subscribe(presenceHandler);
events.publish("contacts.ready");
events.publish("roster.ready");
});
events.subscribe("xmpp.disconnected", onDisconnected);
};
Expand All @@ -142,14 +140,24 @@ function (events, xmpp, xpath, rosterCache, jidParser) {
var contact = roster.contacts[jid];
Object.keys(contact.resources).forEach(function (resource) {
delete contact.resources[resource];
events.publish("contacts.unavailable", null, jid, resource, "");
events.publish("roster.unavailable", null, jid, resource, "");
});
});
xmpp.unsubscribe(rosterIQHandler);
xmpp.unsubscribe(presenceHandler);
events.subscribe("xmpp.connected", onConnected);
};

var mergeRoster = function (oldRoster, newRoster) {
oldRoster.version = newRoster.version;
Object.keys(oldRoster.contacts).forEach(function (jid) {
delete oldRoster.contacts[jid];
});
Object.keys(newRoster.contacts).forEach(function (jid) {
oldRoster.contacts[jid] = newRoster.contacts[jid];
});
};

var isIdenticalRosterItem = function (item1, item2) {
return (
["name", "ask", "subscription"].reduce(function (identical, property) {
Expand Down Expand Up @@ -202,18 +210,18 @@ function (events, xmpp, xpath, rosterCache, jidParser) {
) {
resource.priority = 0;
}
events.publish("contacts.available", presence, jid.bare, jid.resource, resource);
events.publish("roster.available", presence, jid.bare, jid.resource, resource);
break;
case "unavailable":
delete contact.resources[jid.resource];
var status = xpath(presence, "/client:presence/status", Object, xmlns);
events.publish("contacts.unavailable", presence, jid.bare, jid.resource, status ? status.textContent : "");
events.publish("roster.unavailable", presence, jid.bare, jid.resource, status ? status.textContent : "");
break;
case "subscribe":
case "subscribed":
case "unsubscribe":
case "unsubscribed":
events.publish("contacts." + type, presence, jid.bare, jid.resource);
events.publish("roster." + type, presence, jid.bare, jid.resource);
break;
}
}
Expand All @@ -227,7 +235,7 @@ function (events, xmpp, xpath, rosterCache, jidParser) {
var changedContacts = parseRosterIQ(iq, roster).changedContacts;
if (Object.keys(changedContacts).length > 0) {
rosterCache.save(xmpp.connection.jid.bare, roster);
events.publish("contacts.change", changedContacts);
events.publish("roster.change", changedContacts);
}
return true;
}
Expand Down
7 changes: 1 addition & 6 deletions modules/rosterCache.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(function () {
define(function () {
var rosterCache = null;
/*{
"user@server": {
Expand Down
7 changes: 1 addition & 6 deletions modules/search.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(
define(
[
"core/paths",
"core/events",
Expand Down
7 changes: 1 addition & 6 deletions modules/twitterSearch.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
/**
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
*/
define(["core/events"], function (events) {
define(["core/events"], function (events) {
events.subscribe("search.query", function (queryString) {
/* TODO: Don't use require.js for this JSONP call since it doesn't clean up the script tag and caches results.
See: http://requirejs.org/docs/api.html#jsonp
Expand Down
5 changes: 0 additions & 5 deletions qunit.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
<!DOCTYPE html>
<!--
This file is part of Web Client
@author Copyright (c) 2010 Sebastiaan Deckers
@license GNU General Public License version 3 or later
-->
<html>
<head>
<meta charset="utf-8" />
Expand Down
Loading

0 comments on commit c89cea1

Please sign in to comment.