Skip to content

unchatbar/unchatbar-contact

Repository files navigation

Unchatbar contact

Build Status

Peer to peer chat application using WebRTC technologies

Requirements

  • Node.js 0.10+
  • Chrome 26+ or Firefox 23+

Installation

  • Install Bower: npm install -g bower
  • Install Gunt CLI: npm install -g grunt-cli
  • Clone repository git clone git://github.com/unchatbar/unchatbar.git
  • Run npm install to install required Node.js modules
  • Run bower install to install required Bower components

Dependencies

  • angular
  • json3
  • es5-shim
  • bootstrap-css-only
  • ngstorage
  • lodash
  • ui.router
  • angularjs-dropdown-multiselect
  • unchatbar-connection
  • unchatbar-user
  • gettext

Get Started

angular.module('app', ['unchatbar-contact'])

configure route see below

Configure

  • necessary routing configuration
.state('contact', {
    url: '/contact'
})
.state('contact.client', {
    parent: 'contact',
    url: '/user/{clientId}'
})
.state('contact.group', {
    parent: 'contact',
    url: '/group/{groupId}'
})
.state('channel', {
                    parent: 'contact',
                    url: '/{channel}',
                    resolve:{
                        getPeerId: ['$stateParams','PhoneBook',function( $stateParams,PhoneBook){
                            $stateParams.clientId = PhoneBook.getClientByChannel($stateParams.channel).id || null;
                            $stateParams.groupId = PhoneBook.getGroupByChannel($stateParams.channel).id || null;
                        }]

                    }
                })
;
  • store PhoneBook Data in local Storage
PhoneBookProvider.setLocalStorage([TRUE/FALSE]);

API

  • get get Client (by peer id)
PhoneBook.getClient([PEERID]);
  • get all clients
PhoneBook.getClientMap();
  • get new client
PhoneBook.addClient([PEERID],[PROFILE]);
  • update client
PhoneBook.updateClient([PEERID],[Label]);
  • remove client
PhoneBook.removeClient([PEERID]);
  • get a group by groupid
PhoneBook.getGroup([GROUPID]);
  • get all groups
PhoneBook.getGroupMap();
  • copy a group from other client
PhoneBook.copyGroupFromPartner([PEERID],[NEWGROUP]);
  • add a own new group
PhoneBook.addGroup([GROUPNAME]);
  • update a group
PhoneBook.updateGroup([GROUPID],[GROUP]);
  • remove a group by groupid
PhoneBook.removeGroup([GROUPID]);
  • remove a client from group
PhoneBook.removeGroupByClient([PEERID],[GROUP]);

Directive

  • list of all client
<un-contact-client-list data-custom-template-url="[CUSTOM-TEMPLATEPATH]"></un-contact-client-list>
  • select client
<un-contact-client-selected data-custom-template-url="[CUSTOM-TEMPLATEPATH]" data-client-filter="[FILTEROBJECT]"></un-contact-client-selected>
  • admin dialog for active client
<un-contact-client-admin data-custom-template-url="[CUSTOM-TEMPLATEPATH]"></un-contact-client-admin>
  • count client in list by filter
<un-contact-client-count data-custom-template-url="[CUSTOM-TEMPLATEPATH]" addition-class="[CSS-CLASS]" data-client-filter="[FILTEROBJECT]"></un-contact-client-count>
  • list of all groups
<un-contact-group-list data-custom-template-url="[CUSTOM-TEMPLATEPATH]"></un-contact-group-list>
  • select group
<un-contact-group-selected data-custom-template-url="[CUSTOM-TEMPLATEPATH]"></un-contact-group-selected>
  • add new group
<un-contact-group-add data-custom-template-url="[CUSTOM-TEMPLATEPATH]"></un-contact-group-add>
  • admin dialog for selected group
<un-contact-group-admin data-custom-template-url="[CUSTOM-TEMPLATEPATH]"></un-contact-group-admin>
  • count groups
<un-contact-group-count data-custom-template-url="[CUSTOM-TEMPLATEPATH]" addition-class="[CSS-CLASS]"></un-contact-group-count>

Events

  • PhoneBookUpdate: phoneBook data was update