Commit Graph

228 Commits

Author SHA1 Message Date
JC Brand
d66cf7c2a9 Differentiate between initialize and onConnected 2013-04-14 01:17:51 +02:00
JC Brand
a6fd9450a9 Rename init to initialize
Also make sure to hash all localStorage keys
2013-04-14 01:08:24 +02:00
JC Brand
f2ae33d47c Bugfix in show and moved setup code to init method 2013-04-14 00:47:18 +02:00
JC Brand
d2d10f0661 Bugfix.
Controlbox always appears when page loads
2013-04-12 21:56:24 +02:00
JC Brand
ebfd092e49 Bugfix.
Controlbox didn't auto-appear when a new user made a subscription request.
2013-04-12 21:01:04 +02:00
JC Brand
52bbe024cb Bugfix.
Differentiate more clearly between presence type and the show element
2013-04-12 20:29:37 +02:00
JC Brand
c02dba7682 message time bugfix 2013-04-01 23:42:51 +02:00
JC Brand
09c614816c Make the user search form similar to the status dropdown 2013-04-01 20:50:25 +02:00
JC Brand
54554e94ed Fix closing of controlbox without a connection being present 2013-04-01 19:53:39 +02:00
JC Brand
aa09ea58cd Give more detailed feedback when connecting 2013-04-01 19:48:37 +02:00
JC Brand
2b78460e82 Bugfix, don't call create if we don't yet have a connection 2013-03-28 11:38:16 +02:00
JC Brand
9533f4635f Bugfix. Set up the RosterView after the Controlbox
Also, don't save subscription requesting contacts to cache.
2013-03-28 08:48:00 +02:00
JC Brand
6f5ff13055 Don't check the cache in getVCard since we don't call it so often anymore 2013-03-28 07:35:38 +02:00
JC Brand
fe8ed1282c Better handling of user avatar. Don't create canvas el if there's no avatar.
Also, don't fetch vCards in rosterHandler. This could be very expensive for
large rosters, instead we'll fetch them when a user comes online.
2013-03-28 07:17:05 +02:00
JC Brand
49b4633c3f Send nick along with subscription request.
Additionally:
It's not feasible to get the current user's fullname from a vCard all the time,
so we still get it from the DOM for now.
2013-03-28 07:03:16 +02:00
JC Brand
cd5615f79f initStatus is still usefull when we have undefined initial status.
Also set bare_jid, domain and muc_domain on the xmppchat obj and not the
connection obj.
2013-03-28 06:23:08 +02:00
JC Brand
e41fddee0f Refactored XMPPStatus a bit to remove initStatus and to always show status_message 2013-03-27 20:41:19 +02:00
JC Brand
2500d98ebe Use backbone.localStorage for XMPPStatus model.
This was the last thing still using burry.js, so we now have one less
dependency :)
2013-03-27 20:18:00 +02:00
JC Brand
f6e299cc82 Bugfix. getVCard called errback by mistake. 2013-03-27 19:50:35 +02:00
JC Brand
102218b019 Compatibility changes for backbone 1.0 2013-03-27 19:33:53 +02:00
JC Brand
07a65f5b6a Also show different days on chatrooms.
- Use a template to show the day's date.
- Use time element for the date and datetime attr
2013-03-27 17:07:24 +02:00
JC Brand
acbcf3fd2a Indicate on the chatbox when messages span different days. 2013-03-27 14:13:42 +02:00
JC Brand
43434043ab Store time as iso8601 strings on messages 2013-03-27 13:55:18 +02:00
JC Brand
cdcbe41d59 Refactored rosterChanged method.
Roster changes are listened to on the rosterview and the applicable chatbox is
updated.

Custom status messages are now remembered upon page load.
2013-03-25 13:08:27 +02:00
JC Brand
7046656370 Bugfix. Controlbox showed automatically upon page load 2013-03-25 12:00:24 +02:00
JC Brand
1c3a5a94cc Don't store chatroom messages, the XMPP server (ejabberd) does this already. 2013-03-25 10:44:13 +02:00
JC Brand
e964e97285 Properly clear message counter upon page reload 2013-03-24 21:45:55 +02:00
JC Brand
744c575a6a Bugfix. Message counter was not replacing previous count 2013-03-24 21:31:56 +02:00
JC Brand
a4b69ded7d Save to localStorage messages sent in chatroom.
Also removed the need for the appendMessage method.
2013-03-24 21:26:21 +02:00
JC Brand
b49f21558c Remove closeChatRoom and reuse closeChat on ChatBoxView 2013-03-24 17:54:29 +02:00
JC Brand
2d08916ce7 Remove the keyPressed method from ChatRoomView and reuse the one on ChatBoxView 2013-03-24 17:49:42 +02:00
JC Brand
337a3c2bdb Remove ChatRoom model and instead re-use normal ChatBox model. 2013-03-24 17:44:47 +02:00
JC Brand
eaf39165ae Use scrollDown and make sure newly created chatboxes are scrolled down 2013-03-24 17:23:13 +02:00
JC Brand
d27c69d7b9 Set up the roster earlier
and do the fetching and sorting when the view is initialized
2013-03-24 17:09:49 +02:00
JC Brand
d985b7ae27 More bugfixes.
Specifically handle the case where a chatbox was destroyed, and then opened again.
We still have the view, so we reuse it.
2013-03-24 14:01:55 +02:00
JC Brand
efad677f16 JSLint 2013-03-24 12:53:29 +02:00
JC Brand
b495f83745 Now also remove openControlBox 2013-03-24 12:36:40 +02:00
JC Brand
d0b9761d20 More work to remove the need for collection-view anti-pattern.
Remove createChatBox from chatboxesview and move the message received listener to chatboxes
2013-03-24 12:34:41 +02:00
JC Brand
9d89779bee Remove openChat and showChat from chatboxes view and use events instead 2013-03-24 12:05:13 +02:00
JC Brand
974aa02605 Remove unused method 2013-03-24 11:49:22 +02:00
JC Brand
75cb595d50 Move roster change listener to a seprate method.
Move render, show and message fetching from ChatBoxesViews to ChatBoxView
2013-03-24 11:48:12 +02:00
JC Brand
1e3427adcf Try to make more use of events
and get rid of using chatboxesview to control chabox views
2013-03-24 11:18:26 +02:00
JC Brand
a1b7eed7ac That must be !prebind 2013-03-22 17:43:51 +02:00
JC Brand
7a90876ad7 Fixed again for the non-prebinding usecase. 2013-03-22 17:43:00 +02:00
JC Brand
c8def35af8 Remove xmppchat.ClientStorage, it's not being used anymore 2013-03-22 15:12:11 +02:00
JC Brand
6fe5ac7224 Messages are now also saved and retrieved via backbone.localStorage 2013-03-22 15:02:33 +02:00
JC Brand
9dd2f98841 Bugfix.
Couldn't save messages because localStorage wasn't activated for xmppchat.Messages
2013-03-22 13:17:37 +02:00
JC Brand
0f1f438266 Fixes for the case where a user binds to an existing connection
- Previous changes broke for the use-case with Plone, where the user
  doesn't log in manually.
- These changes probably broke the manual log-in use case again, but
  the design is now a bit cleaner and it won't be too hard to fix.
- Chatboxes are now also stored in backbone.localStorage \0/
2013-03-22 10:37:21 +02:00
JC Brand
6f25bfefb8 Cleanup 2013-03-22 08:47:43 +02:00
JC Brand
26cc218ca4 Syntax fixes 2013-03-22 08:34:28 +02:00
JC Brand
fba9bcfde6 ChatBoxes are now saved and fetched from backbone.localStorage.
Also made some initial changes to save/fetch messages from
backbone.localStorage
2013-03-22 08:22:04 +02:00
JC Brand
48e4ed271e Big refactoring.
Removed ControlBox model, and instead only create ChatBox models inside
ChatBoxes collection (the Controlbox is now also a ChatBox).

This enables us to use backbone.localStorage for saving open chatboxes (saving
and fetching currently not implemented).

createChatBox now doesn't return a ChatBoxView instance anymore. In the case
where a view was needed (to append a message), we create the message on the
ChatBox and let the view update via an event trigger. This is much more Backbonic ;)

Also created a Message model. This will most likely enable us to in the future also
store messages via backbone.localStorage.
2013-03-21 14:11:45 +02:00
JC Brand
2fe7164df6 Add errbacks for getVCard 2013-03-21 12:29:59 +02:00
JC Brand
ee3da4e40e Show the controlbox toggle by default.
Also, make sure RosterItems localstorage is user specifici
2013-03-21 11:43:35 +02:00
JC Brand
df931af213 Re-implement the login dialog as part of the controlbox. 2013-03-21 10:54:41 +02:00
JC Brand
e9916ec912 Cache vCard retrieval.
We still need a cache invalidation mechanism. Currently PEP event notifications look most promising.
http://xmpp.org/extensions/xep-0163.html
http://xmpp.org/extensions/xep-0292.html#self-pubsub
2013-03-20 11:34:54 +02:00
JC Brand
219089d261 Specify Chatboxes collection's contained models 2013-03-19 10:45:18 +02:00
JC Brand
f28e20dc41 Call render on the roster if an item is removed, to clear headings. 2013-03-15 07:22:37 +02:00
JC Brand
4eae6ae2aa Bugfix.
User wasn't being removed from the roster if their buddy unsubscribed.
2013-03-15 07:17:49 +02:00
JC Brand
a28b17bb14 Make sure the roster is shown when a user subscribes 2013-03-15 06:48:28 +02:00
JC Brand
a1f5c31967 Remove last vestiges of jquery-ui 2013-03-12 14:31:46 +02:00
JC Brand
b7e191f2b7 Handle removal of roster items from the cache.
- Also, use the browser's confirm dialog, to remove the dependency on jquery.ui
2013-03-12 10:56:50 +02:00
JC Brand
db158876b2 Add initial support for caching roster items to localstorage
- Uses Backbone.localStorage
- Unsubscribing/removing contacts from this cache is not yet tested/implemented
2013-03-12 09:42:33 +02:00
JC Brand
112c8c612e More presencing and chat status fixes.
- Try to clear up the confusion between presence_type (i.e type attr) and
  chat_status (i.e <show> element).
- Properly set chat status and custom status message.
2013-03-06 11:42:53 +02:00
JC Brand
49fd8a7ecd Fix presence exchange.
- Added 'show' element
- 'busy' must be 'dnd'
2013-03-05 22:57:05 +02:00
JC Brand
dfc1b73d11 Refactor some code out of the presenceHandler.
Also, don't hide the controlbox in the beginning, no need to.
2013-03-05 19:18:40 +02:00
JC Brand
1966d5ab56 Fix RosterHandler through proper closure. 2013-03-05 18:35:06 +02:00
JC Brand
bd5269c232 Various fixes, see below:
- Don't do an ajax call when a user wants to subscribe. We wanted to get the
  user's fullname, but this is now handled via vCards
- openChat is now only for roster items. Call showChat for controlbox and
  createChatRoom for rooms.
2013-03-05 10:15:48 +02:00
JC Brand
8f697923f2 Replace another server call with VCard.
This time when a message is received for the first time.
2013-03-05 09:33:29 +02:00
JC Brand
121fab13a8 Add getVCard method (will be usefull for caching later) 2013-03-05 09:17:06 +02:00
JC Brand
2791143508 Set the avatar image on the rosteritem obj 2013-03-04 23:05:01 +02:00
JC Brand
4b670228ff Fix canvas image ratio (don't stretch or squash) 2013-03-03 20:30:07 +02:00
JC Brand
daa31794d7 Render the vCard profile picture 2013-03-03 20:14:11 +02:00
JC Brand
d9f8b957d0 More refinements. 2013-03-03 18:04:45 +02:00
JC Brand
4c1f857741 Fetch vCard when restoring a previously opened chat 2013-03-03 17:27:14 +02:00
JC Brand
e3fa8325b8 Add initial vcard support 2013-03-03 17:27:14 +02:00
ichim-david
c4cafb8c4f Changed the following:
- Chain calls on initialize method of RosterView
- Moved dom insertion out of loops on initialize method of
  XMPPStatusView
2013-03-02 09:32:26 +02:00
ichim-david
d8e4f848b6 Wrap this with jQuery only once in subscribeToSuggestedItems; Same thing with presence in presenceHandler 2013-03-02 09:05:23 +02:00
ichim-david
58bbbe8b9d Cached message from attribute of messageReceived method 2013-03-02 08:54:41 +02:00
ichim-david
e635fb4fc4 Chain jQuery methods for show and render of onChatRoomMessage 2013-03-02 08:41:51 +02:00
ichim-david
5ee9a678c9 Changed the following:
- removed extra jQuerify wrapping of message at onChatRoomMessage
- Construct an array of strings and add it to onChatRoomRoster only
  after loop is done in order to have only 1 dom insertion
2013-03-02 08:36:47 +02:00
ichim-david
764a710158 Cached presence for onChatRoomPresence and removed length comparision to > 0 2013-03-02 08:28:50 +02:00
ichim-david
300b069a0e Use ; Do only one dom insertion in case of /help 2013-03-01 21:53:48 +02:00
ichim-david
6afb091d12 Cached available-chatrooms calls to avoid dom calls on updateRoomList 2013-03-01 21:46:02 +02:00
ichim-david
18f877b59c Changed the following:
- Chained call to render and show methods of ChatBoxView
- Cached target for subscribeToContact
- Removed check of length > 0
2013-03-01 21:38:47 +02:00
ichim-david
5c5b7b9dd7 Changed the following:
- Removed situation where extra data passed in keyPressed was overriden
  with the same result because of the two assignments inside the if
  statements
- Cached fullname and presence_type at initialize of ChatBoxView
2013-03-01 21:23:55 +02:00
ichim-david
87d66b0dec Changed the following:
- Cached length of every iteration in order to avoid having to calculate
  length on every iteration
- Changed insertClientStoredMessaged length check to use the simple length of
  the array instead of using underscore size since
- Added description with need of underscore size method for roster on
  onChatRoomRoster since the roster is an object not an array
2013-03-01 21:07:27 +02:00
ichim-david
fdddecbeb2 Fixed the following:
- Added missing var statements for variable declarations
- Added TODO entries for code that needs to be used or further tested
- Removed unused variables
- Removed check of length > 0 as it's enought to check just item.length
  as a boolean
- Renamed scrolldown to scrollDown to keep a consitent style of method
  naming
- Removed extra jQuery wrapping for many objects and instead define it
  once and use it in the other places
- Use jQuery chaining for modifying connecting message in
  jarn.disconnect
- Define wrapped message in messageReceived from line 342 instead of
  expecting it to be received from the other messageReceived function
2013-03-01 20:43:41 +02:00
JC Brand
10be57aec4 Add strinclude function 2013-02-28 20:42:08 +02:00
JC Brand
d7cb92c7af Merge pull request #3 from ichim-david/master
Optimize actions done in RosterView.
2013-02-28 00:31:46 -08:00
Alexandru Ghica
0f9c088c41 Added error_icon.png and spinner.gif images
Added error_icon.png and spinner.gif images to not make it dependent of
Plone resources.
2013-02-25 16:29:45 +02:00
ichim-david
fe0034f123 Check also if subscription === to in order to correctly move the accepted contact subscription from pending to current 2013-02-25 14:34:02 +02:00
ichim-david
63134858d7 Properly hide or show dt that no longer have dd adjacent 2013-02-24 11:31:47 +02:00
ichim-david
19caf7c448 Prevent default event for the removeContact link in order to avoid page reload when jQuery Dialog is openened from clicking on the delete link 2013-02-24 10:59:57 +02:00
ichim-david
00aba6a9cd Move the event handlers on the view instead of registering them in render method of RosterItemView 2013-02-23 22:20:53 +02:00
ichim-david
7daa681ac3 Show dt elements on xmppchat-roster only if they have length and they are not already visible to avoid making them all the time visible when they might already be so 2013-02-23 16:49:01 +02:00
ichim-david
85e9c7cecc Changed the following:
- Subscribe event with help of jQuery one instead of delegate, now that
  the rosterView is no longer emptied on every render to avoid
  registring several handlers of remove action, which meant you had to
  click 4 times for the jQuery Dialog to go away
- Remove the element from the rosterView when the remove event is
  triggered on the model which removes just that item instead of
  emptying the list and appending the remaining models again
2013-02-23 16:17:00 +02:00
ichim-david
d8d3a34737 Fixed a bug where controlbox wasn't available on xmppchat.chatboxesview, instead pass the removal of the model to rosterview.model 2013-02-23 15:43:20 +02:00
ichim-david
083f76b7cc Fixed merge conflicts for converse.js 2013-02-22 16:45:42 +02:00
Alexandru Ghica
8c45f23255 Better message on error
Changed message from "conecting" to "error" as in this case
communication was over and was an error.
2013-02-22 15:51:50 +02:00