Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for a info message on the echolink connect page #432

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

firealarmss
Copy link

Adds a feature to display a set message (from the config file) on the echolink app when connected.

channels/chan_echolink.c Outdated Show resolved Hide resolved
@@ -1820,6 +1825,23 @@ static void send_info(const void *nodep, const VISIT which, const int depth)
ast_log(LOG_WARNING, "Exceeded buffer size");
return;
}

if (instp->mymessage[0] != '\0') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment in English explaining what you are trying to do here (convert all the "\n" to "\n")
Also, I'm curious why you choose to modify the original buffer here, it seems like the memmove's will therefore only happen the first time? In that case why not choose to do that when the buffer is initialized to begin with? That might be a little bit more logical. Alternately, if you wanted to leave the original buffer intact, you could move the snprintf calls into the loop.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be resolved.

if (instp->mymessage[0] != '\0') {
char *p = instp->mymessage;
while ((p = strstr(p, "\\n")) != NULL) {
*p = '\n'; // Replace the literal \n with a newline character
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Asterisk coding guidelines include :

* Don't use C++ type (//) comments.

and we're trying to follow those conventions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be resolved.

i += j;

if (instp->mymessage[0] != '\0') {
char *p = instp->mymessage;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend moving your \n replacement to the store_config routine. This would be around line 3847 where you store the message from the config file. The replacement only needs to happen one time. (The existing code will only do that replacement once, but we will use a few cycles testing the message every time we send the info message.)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a good change to make.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@firealarmss What do you think about the requested change? If OK, can you update your changes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Allan-N I will make the requested change in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants