Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 28-Aug-2014 14:46:20

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Creating a non ui chat plugit to work with html integration

I'm opening this thread regarding writing a non ui chat plugit, which will do the following:

It will send messages to the server as a plugit action with strings sent from the activex message plugit.
It will have a received message event, which will allow it to send strings to the activex message plugit.
It will send private messages to the server as a plugit action with strings sent from the activex message plugit.
It will have a received private message event, which will allow it to send strings to the activex message plugit.
It will send a changed login to the server as a plugit action with strings sent from the activex message plugit.
It will have a received changed login event, which will allow it to send strings to the activex message plugit.

I may modify the actions and events depending on how the project works with html integration (using javascript and dhtml to write and read strings from a div element using the innerhtml javascript methods.)  Perhaps parsing incoming and outgoing messages will happen in the plugit, or perhaps in the hosting web page, I haven't decided yet.

This plugit will give users the flexibility to create their own chat interfaces without using the os3d buffer to display chat, thereby (perhaps?) saving cpu/gpu resources.

Offline

#2 28-Aug-2014 20:26:59

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: Creating a non ui chat plugit to work with html integration

Hi !

I'm not sure it will save cpu or resources, but the goal is just different.

from the current chat plugit just replace javascrip calls by events to the axmessage.
you will need to create a sort of api to replace functions names.

Offline

#3 28-Aug-2014 20:50:31

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: Creating a non ui chat plugit to work with html integration

Yes, an only string in a specific event for the received message or the changed login.
Another plugit to display them in ui (aX or other)

Offline

#4 29-Aug-2014 16:23:02

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: Creating a non ui chat plugit to work with html integration

The first step will be to:

1.have hard coded message sent from dialog plugit ok event to nonuichat plug it to trigger nonuiplugit action to send message to server.(I can do this)
2. Have nonuichat plugit received message event send incoming string from server to dialog plugit to display. (I think I can figure this out but if one of you more knowledgeable scollistes can write this without any thinking you are welcome to do so.)

Any input welcome.

Offline

#5 29-Aug-2014 18:03:28

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: Creating a non ui chat plugit to work with html integration

Generally, you are two ways to do that :

1- A client sent a message with the recipient to a server. Like an email.

2- A client send a message directly to the recipeint. Like P2P.

With 1, each recipient should be known either the sender or the server (in this last case, the sender gives an ID or something to define the recipient near the server).

With 2, each recipient should be known by the sender only.

For instance, each entered client is registered (in a server or in each already present clients) to update a list (a structure or other) "clients".

So, something like that  :

client.entered -> yourplugit.register (with ID, login, IP what you want)
client.exited-> yourplugit.unregister

To send a message, the sender has the recipient ID. It sends the message and the ID to a server. The server translate the ID to the IP (or what have you other want) and send the message.
The recipient receives the message and an other plugit display it.

or

The sender has the IP and send directly his message (_openchannel and _on or an old DMS function still present in os3d).
The recipient receives the message and an other plugit display it.

For the login, any change is updated in the structure "clients", either the server or each present client.
The core is this "clients" (a structure should be better) : it is hosted on a server or on each present client.
Basically, it is updated when :
- a new client comes
- a client exits
- a client changes his login.

The server version can be simpler but you have to add a code on a server (and have a server).
The P2P version is a bit harder but it allows more flexible use (and all code is in plugIts).

Basic "clients" example :

structure Clients = [
  cliID : I,
  cliIP : S,
  cliLogin : S
] mkClients;;

typeof clients = [Clients r1];;

fun setNewID (...)=
  // to generate an unique ident
  // must return the generated id

fun getCliIP (...)=
  // use the current API to get the client IP
  // must return the IP

fun getCliLogin (...)=
  // get the default login sets in the Scol settings
  // must return a login (or "guest", or "no name", .... if any)

fun newCli ( ... )=
  let mkClients [nil nil nil] -> c in
  (
  set c.cliID = setNewID ...;
  set c.cliIP = getCliIP ...;
  set c.cliLogin = getCliLogin ...;
  set clients = c :: clients;
  c
  );;

fun delCli ( cli) =
  // browse the clients list to remove the given Client structure

Offline

#6 29-Aug-2014 19:25:12

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: Creating a non ui chat plugit to work with html integration

Thanks Iri....I will look at this and be modifying the existing chat plugit as it is configured with other plugits in the network.xos demo. The plugit structure and links are different than the consolechat project .xos files I was using.
A question about the existing chat plugit....


a question.....what is the difference between the "Get message" and "Display Message" actions?

Last edited by hebdemnobad (29-Aug-2014 20:06:52)

Offline

#7 29-Aug-2014 20:56:57

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: Creating a non ui chat plugit to work with html integration

http://redmine.scolring.org/projects/op … /cchat.pkg

Get message and Display message call the same function addChatText.

Get message :

fun cbGetMessage(inst, from, action, param, reply, constr)=
  if (param == nil) || (!strcmp (strtrim param) "") then nil else
    addChatText constr param;
  0;;

If the message is empty, it is ignored. Else it is displayed as it.

Display message :

fun cbDisplayMessage(inst, from, action, param, reply, constr)=
  addChatText constr strcatn "<strong>"::param::"</strong><br>"::nil;
  0;;

The message is displyed with a strong tag and a return is set.
If the message is empty, it is not ignored : a newline is set.

Indeed, the names may be not clear.

Offline

#8 29-Aug-2014 22:31:11

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: Creating a non ui chat plugit to work with html integration

Thx Iri

Offline

#9 1-Sep-2014 13:57:50

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: Creating a non ui chat plugit to work with html integration

I think it would be clearer if the functions (and corresponding actions would be)

Display Message instead of Get Message
Display Bold Message instead of Display Message

maybe it is something about French and English....Get Message makes me think that the chat plugit is retrieving the message, but not necessarily doing anything with it.

Offline

Board footer

Powered by FluxBB