This component adds a mobile-first, individually styled web chat module to OSSN. You need the Pusher Channels service for realtime updates.
You'll want to add the link to the main menu AND/OR redirect logins directly to WebChat using the Component Admin page:
v2.0.3 BETA 16th Dec 2020
OSSN >= v5.6
OssnMessages >= 5.4
OssnServices >= 6.4
Private Network >= 5.4
FREE key from https://developers.giphy.com
FREE Channels app-key from www.pusher.com
https://kjbtech.co.uk/ossn
Demo site is running ossn 5.6, GreenByGreen theme and only has Private Network, API Services and WebChat components installed.
Add ossn credit
Message status dialog
Online status for group members
Block message content of blocked users
Hide blocked users from create new chat dialog
User is typing...
MP4 video uploads
Limits on number of images/videos people can upload
Allow to share images directly from profile
Add type to message table GIPHY, info, photo, profile image etc.
Implement OSSN blocked users
Migrate chat_api to ossn actions
Implement mobile notifications
Decide on consistent naming convention throughout. Is it Groups / Chats / WebChat etc. Need to keep language consistent throughout.
Remove ALL error_log / console.log and debug responses
Finish tidying up code and commenting (if I have time to kill)
CSS animations / transitions to make the experience feel more app-like.
Sounds for sending/receiving messages
White border on giphy thumbnail selection
change giphy default search as it keeps failing
Encryption and Presence / Private Pusher Channels
Public/Private groups (to plan)
Voice and Video calls
Public Webcam broadcasts / channels
User Search by distance/gender etc
Who looked at me?
View and manage profile / galleries
View and post to walls
I'd be grateful for feedback on how I could improve the component. Any bugs or issues please also report here.
Version history can be found in this Google Doc
WebChat Version History
Hi Kevin, I have the file in French language: ossn.fr.php
If you're interested, tell me where to send it to you
I'm happy to leave that where it is. It's not really doing any harm.
I have fixed the multi-line messages you requested, and added a send button in the process :) Added a nice feature where the input box grows as you type - and keeps the icons locked in place next to where you are typing.
And I have mostly sorted out the issue with the encoding. OSSN Message can see all characters correctly now.... but for some reason i'm inserting Unix style new line characters "\n" in place of the CRLF.
If you look at the below image, you can see how it displays side-by-side. WebChat displays it fine, by OSSNMessage doesn't like the characters. If you look bellow the screenshots, I have included a snippet of the ossn_messages table showing how the data appears in the table. Its near identical - but has \n in place of CRLFs.
I have spent literally 5 hours (18:07 - 23:34) tonight trying to figure this out. I tried all sorts of combinations of nlbr, mbconvertencoding, regex replacements and all sorts... I just can't lose those \n's !!!
I have also resorted to dumping my call to the API, and instead replaced it with a call to OSSNMessage - so it's now using OSSN Message to post the message, instead of the API.
Watching the response from ossn_plugin_view('messages/templates/message-send'...
from both WebChat and OSSNMessage, I can see the \n coming back in response to the WebChat request, and </br> coming back in response to the OSSNMessage request. :( Is it perhaps because my main page is sending the message via curl to chat_api.php first? and that process is changing the format?
I am pulling my hair out here - so any pointers or suggestions would be greatly appreciated! :D
When it fails, the session has already been established and we are inside the logged-in loop.
Also, everything else in the loop after the hook runs fine. So at the point that it executes the addHook, it's already checked the session status successfully otherwise it would be running the else clause instead?
Yes, and that starts to make sense if you have a look into ossn.lib.users:
The logged-in/logged-off state is retrieved from the SESSION!
And since you're calling curl without extra SESSION specific options, it simply doesn't pass the existing session to Ossn, so ossn_isLoggedin()
returns false here and your add_hook isn't reached at all.
But we don't need to worry about placing the hook outside, because all api calls are secured by the api key anyway. Aside from that: The idea of the api originally WAS MEANT to work by being called externally. And these 3rd party calls of course can't rely on whether there's an existing Ossn session or not, they simply have work anytime.
Ok, so tried that and it clearly shows that the addhook fails to register the API extension if it is performed inside the "ossnisLoggedIn() loop.
:(
Ok I'll give that a try. I'd put the hook inside the logged_in previously.
Re
Fixed notifications and new messages that were not arriving. Custom Web API Extension was failing to register
Try to comment out that extra
ossn_register_callback('ossn', 'init', 'unread_messages_count_api');
and move that add_hook
from line #27 before (outside of) if(ossn_isLoggedin()) {
This is great feedback, thanks again :)
Ok, so currently I'm using the enter to submit, so you'll not get a new line. I'll have to put a submit button back on the screen and ignore the enter key to allow new lines. That's a quick easy one :)
I'll have to dig a little further into the special characters. Its probably the way I'm submitting them to the API. I may consider stripping out the API call and use an ossn function directly instead.
Running 1.3.6 now I'm still getting encoding issues:
Emojis are working fine now, but apostrophes still not.
a compatible newline support support should be implemented, too
Hi John,
There was a couple of rogue characters in the manifest :*)
I've generated a new one, along with a selection of icons, and it should now work much better. You'll have to clear all the cache from your phone before trying again though, as the manifest seems to get cached locally otherwise.
Let me know how you get on.