slabbi / uddeIM

udde Instant Messages (uddeIM) - Instant Messages System for Mambo and Joomla
12 stars 9 forks source link

pass message with url query string #103

Closed reilldesign closed 1 month ago

reilldesign commented 4 months ago

Currently, a new message to a recipient can be created very easily using the url query string

...?task=new&recip=10

Now it would be very helpful to pass a part of the message as well. Is this already possible?

joomod commented 4 months ago

I don't know if should be common available. you can edit the uddeim.php (site folder) with this line: (after $pmessage = strip_tags.... line 176)

//ability to send pretext with url if pmessage is not used

if (!$pmessage)
$pmessage   = uddeIMmosGetParam ( $_REQUEST, 'pm');

now you may use &pm=some text in the url query

reilldesign commented 4 months ago

Thank you very much, it works smoothly. Will you add this function to the component?

slabbi commented 4 months ago

There is an API for creating messages.

reilldesign commented 4 months ago

We use this URL in an article override to create a new message via a link and to adopt the article title. The user then has the option of adding to the text. This path would be optimal for this.

joomod commented 4 months ago

Thank you very much, it works smoothly. Will you add this function to the component?

don't know about security. @slabbi is there any risk by implementing this

(as far as I can see, it is nothing more than a user could input in the message textarea)

slabbi commented 4 months ago

Section 13.2 in the manual:

13.2 Pass a message text to uddeIM from a 3rd party program

I want to pass a message along with the "recip" in a URL call that opens a message to that "recip".

<a href='/index.php?option=com_uddeim&task=new&recip=63

So something like above, but add &message="this is the message to the recipient"

I am sorry, this is not possible. There are several issues why I do not implement this feature:

reilldesign commented 4 months ago

As far as I can tell, only two fields are pre-filled. The message still has to be sent manually. There is no automatic sending via the URL.

joomod commented 4 months ago

as @reilldesign said, it is only a prefilled text input, which also could be typed by an user, nothing is send automaticly, so I don't see any risk (also no string cleaning is used, this will be done during the send process)

slabbi commented 4 months ago

Ok, your decision

joomod commented 4 months ago

I think I will create a new config variable for this and then check if (!$pmessage && isset($config->allowurltext)) $pmessage = uddeIMmosGetParam ( $_REQUEST, 'pm');

so only if set in the config the &pm query is available (and also a short explain for this can be written)

joomod commented 1 month ago

integrated in v5.6