• JS Formatting

    From DesotoFireflite@VERT/VALHALLA to All on Sunday, July 10, 2022 07:24:42
    I added a message option to send me an email everytime a new user was verified by the emailvar.js. It's working correctly, and I'm very satisfied with my efforts to make it work. The message it send to my email is as follows:

    -+- Snipit ----
    msgtxt = "New Member, Alias: " + user.alias + ", #: " + String(user.number) + ", Joined " + system.name + " Today " + (new Date());
    -+- Snipit ----

    expands as follows in the message:

    New Member, Alias: Tuff, #: 191, Joined Valhalla Home Services Today Sun Jul 10 7:15:32

    I would rather it to be somewhat like this:

    New Member Joined Valhalla Home Services Today Sun Jul 10 7:15:32.

    Alias: Tuff
    Number: 191

    Is there a way to do this. For the like of me, I can't find a way to do this formatting. I'm successful in doing it in one line, but I'm trying to learn more. Thanks in advance.

    SysOp: C.G. Learn, AKA: DesotoFireflite
    Valhalla Home Services! - (Synchronet) - bbs.valhallabbs.com:23
    A Gamers Paradise - Over 250 Registered Online Game Doors!

    --- Don't eat the yellow snow!
    Synchronet Valhalla Home Services USA http://valhalla.synchro.net
  • From Digital Man@VERT to DesotoFireflite on Sunday, July 10, 2022 14:40:26
    Re: JS Formatting
    By: DesotoFireflite to All on Sun Jul 10 2022 07:24 am

    I added a message option to send me an email everytime a new user was verified by the emailvar.js. It's working correctly, and I'm very satisfied with my efforts to make it work. The message it send to my email is as follows:

    -+- Snipit ----
    msgtxt = "New Member, Alias: " + user.alias + ", #: " + String(user.number) + ", Joined " + system.name + " Today " + (new Date());
    -+- Snipit ----

    expands as follows in the message:

    New Member, Alias: Tuff, #: 191, Joined Valhalla Home Services Today Sun Jul 10 7:15:32

    I would rather it to be somewhat like this:

    New Member Joined Valhalla Home Services Today Sun Jul 10 7:15:32.

    Alias: Tuff
    Number: 191

    Is there a way to do this. For the like of me, I can't find a way to do this formatting. I'm successful in doing it in one line, but I'm trying to learn more. Thanks in advance.

    msgtxt = "New Member Joined " + system.name + " Today " + new Date() + ".\r\n"; msgtxt += "\r\n Alias: " + user.alias;
    msgtxt += "\r\n Number: " + user.number;
    msgtxt += "\r\n";
    --
    digital man (rob)

    Breaking Bad quote #37:
    only the very best... with just a right amount of dirty. - Saul
    Norco, CA WX: 89.7F, 33.0% humidity, 17 mph S wind, 0.00 inches rain/24hrs

    ---
    Synchronet Vertrauen Home of Synchronet [vert/cvs/bbs].synchro.net
  • From DesotoFireflite@VERT/VALHALLA to Digital Man on Sunday, July 10, 2022 19:50:19
    Re: JS Formatting
    By: Digital Man to DesotoFireflite on Sun Jul 10 2022 02:40 pm

    Re: JS Formatting
    By: DesotoFireflite to All on Sun Jul 10 2022 07:24 am

    I added a message option to send me an email everytime a new user was
    verified by the emailvar.js. It's working correctly, and I'm very
    satisfied with my efforts to make it work. The message it send to my
    email is as follows:

    -+- Snipit ----
    msgtxt = "New Member, Alias: " + user.alias + ", #: " +
    String(user.number) + ", Joined " + system.name + " Today " + (new
    Date()); -+- Snipit ----

    expands as follows in the message:

    New Member, Alias: Tuff, #: 191, Joined Valhalla Home Services Today
    Sun Jul 10 7:15:32

    I would rather it to be somewhat like this:

    New Member Joined Valhalla Home Services Today Sun Jul 10 7:15:32.

    Alias: Tuff
    Number: 191

    Is there a way to do this. For the like of me, I can't find a way to
    do this formatting. I'm successful in doing it in one line, but I'm
    trying to learn more. Thanks in advance.

    msgtxt = "New Member Joined " + system.name + " Today " + new Date() + ".\r\n"; msgtxt += "\r\n Alias: " + user.alias;
    msgtxt += "\r\n Number: " + user.number;
    msgtxt += "\r\n";

    WOW, that was simple enough. I had no idea you could do it this way, but after looking at it, it makes perfect sense.

    I wish there was a tips and tricks info site on js, that I could explore.

    Thanks again for the assist.

    SysOp: C.G. Learn, AKA: DesotoFireflite
    Valhalla Home Services! - (Synchronet) - bbs.valhallabbs.com:23
    A Gamers Paradise - Over 250 Registered Online Game Doors!

    --- Don't eat the yellow snow!
    Synchronet Valhalla Home Services USA http://valhalla.synchro.net
  • From Digital Man@VERT to DesotoFireflite on Monday, July 11, 2022 11:15:08
    Re: JS Formatting
    By: DesotoFireflite to Digital Man on Sun Jul 10 2022 07:50 pm

    Re: JS Formatting
    By: Digital Man to DesotoFireflite on Sun Jul 10 2022 02:40 pm

    Re: JS Formatting
    By: DesotoFireflite to All on Sun Jul 10 2022 07:24 am

    I added a message option to send me an email everytime a new user was
    verified by the emailvar.js. It's working correctly, and I'm very
    satisfied with my efforts to make it work. The message it send to my
    email is as follows:

    -+- Snipit ----
    msgtxt = "New Member, Alias: " + user.alias + ", #: " +
    String(user.number) + ", Joined " + system.name + " Today " + (new
    Date()); -+- Snipit ----

    expands as follows in the message:

    New Member, Alias: Tuff, #: 191, Joined Valhalla Home Services Today
    Sun Jul 10 7:15:32

    I would rather it to be somewhat like this:

    New Member Joined Valhalla Home Services Today Sun Jul 10 7:15:32.

    Alias: Tuff
    Number: 191

    Is there a way to do this. For the like of me, I can't find a way to
    do this formatting. I'm successful in doing it in one line, but I'm
    trying to learn more. Thanks in advance.

    msgtxt = "New Member Joined " + system.name + " Today " + new Date() + ".\r\n"; msgtxt += "\r\n Alias: " + user.alias;
    msgtxt += "\r\n Number: " + user.number;
    msgtxt += "\r\n";

    WOW, that was simple enough. I had no idea you could do it this way, but after looking at it, it makes perfect sense.

    I wish there was a tips and tricks info site on js, that I could explore.

    Here are some for this particular topic: https://www.w3schools.com/js/js_strings.asp https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String

    Thanks again for the assist.

    No problem.
    --
    digital man (rob)

    Sling Blade quote #8:
    Karl Childers: I don't reckon I got no reason to kill nobody.
    Norco, CA WX: 80.4F, 49.0% humidity, 2 mph E wind, 0.00 inches rain/24hrs

    ---
    Synchronet Vertrauen Home of Synchronet [vert/cvs/bbs].synchro.net
  • From Tracker1@VERT/TRN to DesotoFireflite on Saturday, July 16, 2022 14:24:15
    On 7/10/22 04:24, DesotoFireflite wrote:

    I would rather it to be somewhat like this:

    New Member Joined Valhalla Home Services Today Sun ...

    Alias: Tuff
    Number: 191

    var msg = [
    "New member joined..." + new Date().toString(),
    "",
    "Alias: " + user.alias,
    "Number: " + String(user.number)
    ].join("\r\n");
    --
    Michael J. Ryan - tracker1@roughneckbbs.com

    ---
    Synchronet Roughneck BBS - roughneckbbs.com
  • From DesotoFireflite@VERT/VALHALLA to Tracker1 on Sunday, July 17, 2022 09:02:16
    Re: Re: JS Formatting
    By: Tracker1 to DesotoFireflite on Sat Jul 16 2022 02:24 pm

    On 7/10/22 04:24, DesotoFireflite wrote:

    I would rather it to be somewhat like this:

    New Member Joined Valhalla Home Services Today Sun ...

    Alias: Tuff
    Number: 191

    var msg = [
    "New member joined..." + new Date().toString(),
    "",
    "Alias: " + user.alias,
    "Number: " + String(user.number)
    ].join("\r\n");

    I decided to go with this below. Since it was your program "emailval.js" to begin with, I wanted a simple way of sending the sysop a message letting him/her that a new user had joined, and was validated. This gives me a quick snapshot of their info. I know it's overkill, but at least it gives me an idea whats going on without having to real logs. In time, I'll add to it those users that failed the validation process.

    msgbase = new MsgBase("mail");
    if(msgbase.open()==false) {
    log(LOG_ERR,"!ERROR " + msgbase.error);
    return(false);
    }

    hdr = {
    to: system.operator,
    to_ext: "1",
    from: user.alias,
    from_ext: String(user.number),
    attr: MSG_KILLREAD,
    subject: "New Member To " + system.name + "!"
    };

    msgtxt = "New Member Joined " + system.name + " On " + new Date() + ".\r\n";
    msgtxt += "\r\n Name & Alias..: " + "Alias: " + user.alias + ", " + " Real Name: " + user.name;
    msgtxt += "\r\n Number........: " + user.number;
    msgtxt += "\r\n Handle........: " + user.handle;
    msgtxt += "\r\n Birthdate.....: " + user.birthmonth + "/" + user.birthday + "/" + user.birthyear;
    msgtxt += "\r\n Location......: " + user.location;
    msgtxt += "\r\n IP Address....: " + user.ip_address;
    msgtxt += "\r\n Email Address.: " + user.netmail;
    msgtxt += "\r\n Gender (M/F/X): " + user.gender;
    msgtxt += "\r\n";

    var result = msgbase.save_msg(hdr, msgtxt);
    if(!result)
    log(LOG_ERR, "!ERROR " + msgbase.error + " saving mail message");

    msgbase.close();
    return result;

    SysOp: C.G. Learn, AKA: DesotoFireflite
    Valhalla Home Services! - (Synchronet) - bbs.valhallabbs.com:23
    A Gamers Paradise - Over 250 Registered Online Game Doors!

    --- I'm so disorganized my keyboard isn't even in alphabetical order!
    Synchronet Valhalla Home Services USA http://valhalla.synchro.net
  • From Rampage@VERT/SESTAR to DesotoFireflite on Monday, July 18, 2022 06:00:22
    Re: Re: JS Formatting
    By: DesotoFireflite to Tracker1 on Sun Jul 17 2022 09:02:16


    readability is a thing...

    msgtxt = "New Member Joined " + system.name + " On " + new Date() + ".\r\n";
    msgtxt += "\r\n Name & Alias..: " + "Alias: " + user.alias + ", " + " Real Name: " + user.name;
    msgtxt += "\r\n Number........: " + user.number;
    msgtxt += "\r\n Handle........: " + user.handle;
    msgtxt += "\r\n Birthdate.....: " + user.birthmonth + "/" + user.birthday + "/" + user.birthyear;
    msgtxt += "\r\n Location......: " + user.location;
    msgtxt += "\r\n IP Address....: " + user.ip_address;
    msgtxt += "\r\n Email Address.: " + user.netmail;
    msgtxt += "\r\n Gender (M/F/X): " + user.gender;
    msgtxt += "\r\n";

    while the above is easy to read, i expect the EOL sequences to be at the end of the line... for blank lines, i place the EOL sequence on a line by itself... the above i would write like this...

    msgtxt = "New Member Joined " + system.name + " On " + new Date() + ".\r\n";
    msgtxt += "\r\n";
    msgtxt += " Name & Alias..: " + "Alias: " + user.alias + ", " + " Real Name: " + user.name + "\r\n";
    msgtxt += " Number........: " + user.number + "\r\n";
    msgtxt += " Handle........: " + user.handle + "\r\n";
    msgtxt += " Birthdate.....: " + user.birthmonth + "/" + user.birthday + "/" + user.birthyear + "\r\n";
    msgtxt += " Location......: " + user.location + "\r\n";
    msgtxt += " IP Address....: " + user.ip_address + "\r\n";
    msgtxt += " Email Address.: " + user.netmail + "\r\n";
    msgtxt += " Gender (M/F/X): " + user.gender + "\r\n";
    msgtxt += "\r\n";

    this makes it much easier to see each output line in the code... hopefully wrapping won't fark it up too badly...


    )\/(ark

    ---
    Synchronet The SouthEast Star Mail HUB - SESTAR
  • From DesotoFireflite@VERT/VALHALLA to Rampage on Monday, July 18, 2022 08:19:53
    Re: Re: JS Formatting
    By: Rampage to DesotoFireflite on Mon Jul 18 2022 06:00 am

    Re: Re: JS Formatting
    By: DesotoFireflite to Tracker1 on Sun Jul 17 2022 09:02:16


    readability is a thing...

    I do understand what you are saying, and there are different ways to acheve the same thing. I see what you did in your scenaro, and I agree it will work, but the way I did it works also. It's just a matter of working style. I can read both ways equally as well, and know what is going on. On my final code, I always put notes in the file to refresh my memory as to what the code was supposed to do, so after time, I won't have to figure it out again. I do find sometimes, after time, I didlike what I do, and go back and change it or tweak it a bit. All and all, the most important thing is, is that it works without undue stress on the system.

    I do appreciate your input, as I'm still learning, and evey comment does help. Thanks

    SysOp: C.G. Learn, AKA: DesotoFireflite
    Valhalla Home Services! - (Synchronet) - bbs.valhallabbs.com:23
    A Gamers Paradise - Over 250 Registered Online Game Doors!

    ---
    Synchronet Valhalla Home Services USA http://valhalla.synchro.net