• Re: JS Formatting

    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