FireUserService.prototype.userJoined = function( user ) {
  if( this._users[ user.userId ] !== undefined ) {
    Log.warn( 'attempt to add user with userId {0}. That user already exists!', user.userId );
    return;
  }

  this._users[ user.userId ] = user;
};
FireChatService.prototype._messageAdded = function( data ) {
  // TODO: consider making this public so it can be tested.
  var message = data.val();

  if( message.timestamp && ( message.timestamp instanceof Number ) ) {
    // parse as millis since epoch. Try...catch to be super-safe
    try {
      message.timestamp = new Date( message.timestamp );
    }
    catch( e ) {
      Log.warn( 'Error parsing Date from Firebase: {0}', e );
    }
  }

  Log.info( 'Message added: {0}', JSON.stringify( message ) );

  this.trigger( 'new-message', message );
};
	var auth = new FirebaseLogin( firebase, function( error, user ) {

  	if (error) {
	    this.errorMessage( error.message );
	  }
		else if (user) {

			if( this._loggedIn ) {
				return; // duplicate
			}

			this._loggedIn = true;
	    Log.info( 'GitHub loggin succeeded. User ID: ' + JSON.stringify( user ) );

			this.trigger( 'user-logged-in', { userId: user.username } );
	  }
		else {
			this._loggedIn = false;
	  }

	}, this );
FireUserService.prototype.userUpdated = function( user ) {
  Log.info( 'userUpdated not implemented' );
};
FireUserService.prototype.userLeft = function( user ) {
  Log.info( 'userLeft not implemented' );
};
/**
 * @private
 * @param {Error} error - Error raised while file watching.
 */
function fileWatchingErrored(error) {
	Log.error("Error while watching file.");
	Log.error(error);
}