1. 03 May, 2019 2 commits
  2. 02 May, 2019 1 commit
    • rswindell's avatar
      get_all_msg_headers(): · 26bc4b6a
      rswindell authored
      Copy the upvotes, downvotes, and total_votes to the smbmsg_t, replicating
      what is done in sbbs_t::scanposts() - these are used by sbbs_t::show_msghdr()
      so we need to copy them if we're going to be replicating that functionality
      (showing up/down votes and score) in message headers shown with bbs.show_msg()
      and bbs.show_msg_header().
      26bc4b6a
  3. 30 Apr, 2019 1 commit
  4. 29 Apr, 2019 2 commits
    • rswindell's avatar
      Includes SMTP "Received" header fields in field_list array. · 25bb4f49
      rswindell authored
      Refer to the dubious get_msg_body() feature of dot-stuffing as that
      ("dot-stuffing") and not "rfc822-encoding" - because it isn't.
      dot-stuffing is a requirment of SMTP (RFC*821) and NNTP, not RFC822 (oops).
      25bb4f49
    • rswindell's avatar
      Add support for new message header fields: · b53ffc8a
      rswindell authored
      - to_list (RFC822TO, previosuly unavailable via JS)
      - cc_list
      - replyto_list (RFC822REPLYTO, previously unavailable via JS)
      
      Added RFC822FROM to the "field_list" array (previously unavailable via JS).
      Removed SMB_CARBONCOPY from the "field_list" (now duplicated in cc_list).
      b53ffc8a
  5. 11 Apr, 2019 3 commits
  6. 09 Apr, 2019 1 commit
  7. 06 Apr, 2019 2 commits
    • rswindell's avatar
      MsgBase.put_msg_header() now updates the internal (smbmsg_t) representation · 53c677c3
      rswindell authored
      of the message header so that functions that need it (e.g. bbs.show_msg_header)
      don't use/show stale data. This change requires the updated smb_copymsgmem()
      which clear/sets message convenience pointers upon copying hfields from one
      message header to another.
      53c677c3
    • rswindell's avatar
      New MsgBase method: get_index() - returns an array of all message index records · 75417a26
      rswindell authored
      (objects, in the same format as returned by the get_mgs_index() method)
      much faster than iterating through a loop, calling the get_msg_index() method
      for each message. If you want to load messages (e.g. headers, text), filtering
      by criteria found in the message index (attributes, to/from user, subject CRC)
      loading a list of indexes and filtering before calling get_msg_header() for the
      selected messages is much faster than previously available MsgBase object
      methods (e.g. get_all_msg_headers()). If you don't need to filter the loaded
      messages (you really want *all* message headers), then get_index() is of no
      benefit to you, the script-writer. This is most useful for the "mail" msgbase
      where selective loading of messages is more common.
      75417a26
  8. 01 Apr, 2019 1 commit
    • rswindell's avatar
      Fix the message base corruption caused by previous committed changes to · a69c1669
      rswindell authored
      js_put_msg_header (MsgBase.put_msg_header) - we can't free the memory
      associated with 'gotten' msg header. Just use the header offset from the
      header retrieved via MsgBase.get_msg_header() - for fast lookup.
      Also fixed an innocuous extra increment of 'n' in argv/argc loop.
      a69c1669
  9. 24 Mar, 2019 1 commit
    • rswindell's avatar
      New JS bbs methods: · b4d31140
      rswindell authored
      - bbs.show_msg()
      - bbs.show_msg_header()
      Re-worked the JS bbs.netmail() implementation
      sbbs::show_msg(), show_msghdr(), msgtotxt() now take an smb_t* argument
      (don't use the pseudo-global 'smb' in these functions any longer)
      sbbs_t::putmsg() and JS console.putmsg() now accept an optional orig_columns
      argument to specify the original column width of a text for intelligent
      re-word-wrapping (e.g. as taken from a message header field). Previously, the
      original-column value was hard-coded to 80 columns (technically, 79).
      sbbs_t::show_msghdr() no longer sends a CRLF if the cursor is already at the
      top-of-screen (TOS).
      sbbs_t::show_msg() now uses the stored "columns" msg header fields to pass to
      putmsg() to intelligently re-word-wrap message bodies for display.
      sbbs_t::show_msg() and msgtotxt() return bool now instead of void.
      JS MsgBase.get_all_msg_headers() now supports an optional "expand_fields"
      argument (defaults to true). I contemplated just getting rid of the (few)
      expanding header fields (more like default-value-header fields, like 'id'), but
      decided against it, at least for now.
      JS MsgBase.put_msg_header(), the "number_or_offset" argument is optional and
      not needed if a header object argument is provided. Make this clear in this JS
      docs for this method
      
      Note:
      I sat on this commit for a while because I noticed occasional errors like this:
          Node 1 <Digital Man> !ERROR 2 (No such file or directory) (WinError 0) in
          readmsgs.cpp line 217 (sbbs_t::loadposts) locking
          "path/to/sub" access=-100 info=smb_locksmbhdr msgbase not open
      started cropping up after introducing these changes and which I never
      root-caused. But after a clean-build and waiting a week, I haven't seen it
      again, so hopefully it was just a incomplete rebuild issue and not a new bug.
      b4d31140
  10. 16 Mar, 2019 1 commit
  11. 13 Mar, 2019 1 commit
  12. 20 Feb, 2019 1 commit
    • rswindell's avatar
      Reversed course on the WM_QUOTE mode handling in sbbs_t::postmsg() · 57424543
      rswindell authored
      (JS bbs.post_msg()): If the WM_QUOTE mode flag is *not* set, then it will auto-
      create the quote file (quotes.txt) and add the WM_QUOTE mode bit before calling
      sbbs_t::writemsg(). So if existing JS scripts call bbs.post_msg(..., WM_QUOTE)
      with a custom-created quote file (e.g. with msg tails), that'll still work as
      before (e.g. DDMsgReader.js).
      
      bbs.email() and bbs.netmail() now support an optional reply_header_object
      argument which works like bbs.post_msg(). These methods (and the underlying
      C++ methods: sbbs_t::email(), netmail(), inetmail(), all auto-create the
      quote file now, when the WM_QUOTE mode flag is *not* set.
      
      The auto-created quotes.txt now includes the plain-text version of MIME-encoded
      messages.
      
      the bbs.post_msg(), email(), and netmail() methods now all support reply
      header objects that came directly from bbs.get_msg_header() *or* copies of
      such header objects (but the auto-quoting feature won't work when supplied
      this type of header object). So if passed a header object returned from
      bbs.get_msg_header(), we can now use the message base (for auto-quoting) and
      the underlying msg storage directly (no JS parsing necessary). This is what
      the new js_GetMsgHeaderObjectPrivates() function is used for.
      
      js_ParseMsgHeaderObject() (and the underlying parse_header_object() function)
      now supports either an actual internally-generated msg header object (e.g.
      returned from bbs.get_msg_header()) or one that is a copy or hand-constructed.
      
      quotemsg() no longer tries to get a copy of the msg index/header. It shouldn't
      have to since we can now get to underlying msg storage in the js_msgbase.c
      via js_GetMsgHeaderObjectPrivates().
      
      quotemsg() now reads only the plain-text portion of MIME-encoded messages.
      
      As part of this effort, I modernized the method prototypes using default
      argument values (e.g. WM_NONE for wm_mode arguments) and removed some
      extraneous WM_EMAIL and WM_NETMAIL specifications (these wm_mode flags are
      automatically added by the sbbs_t::email() and *netmail() functions).
      
      savemsg() now *does* support reply-IDs/thread-linkage via the additional
      'remsg' argument (when non-NULL).
      
      Replaced some use of nulstr with NULL.
      
      Replaced more boilerplate SMB open code with calls to smb_open_sub().
      57424543
  13. 19 Feb, 2019 1 commit
    • rswindell's avatar
      Fix long-standing bug in js_ParseMsgHeaderObject which is only (currently) · 121e87b7
      rswindell authored
      used by js_post_msg() (the JS bbs.post_msg() method when used with the
      reply_header object argument) - the private data attached to a message
      header object is of type privatemsg_t, not private_t. This caused the
      dereferences of and assignments to p->smb_result in parse_header_object()
      to corrupt the privatemsg_t->msg memory causing heap corruption (caught
      on Windows debug builds in js_get_msg_header_finalize()) and stack faults
      (caught on Linux-gcc in parse_recipient_object()). This one was hard to
      find. <whew!>
      121e87b7
  14. 18 Feb, 2019 1 commit
  15. 16 Feb, 2019 1 commit
  16. 22 Jan, 2019 1 commit
  17. 21 Jan, 2019 1 commit
  18. 03 Oct, 2018 1 commit
  19. 06 Sep, 2018 1 commit
  20. 16 Jul, 2018 1 commit
  21. 15 May, 2018 1 commit
    • rswindell's avatar
      Fix get_msg_header() problem reported by Bill McGarrity: · 4f279cb2
      rswindell authored
      "expand fields" could be misinterpretted (e.g. as 'false') if less than 3
      args were passed to the function. Apparently you can NOT assume that argv[argc]
      is undefined and would fail a JSVAL_IS_BOOLEAN test. In the reported problem,
      MsgBase.get_msg_header() was being called with 2 arguments (from newslink.js)
      and the if(JSVAL_IS_BOOLEAN(argv[n])) test, when n was 2, would eval to true
      and then argv[n] evalulated as false, which would cause a message with no
      message ID to not have one dynamically created, which would then cause the
      message to fail to post to an NNTP server due to malformed Message-ID (a
      missing message "id" property would end up being included in the newsgropu
      article header as "Message-ID: undefined").
      
      get_msg_index() had a similar potential issue, also fixed.
      4f279cb2
  22. 10 Mar, 2018 1 commit
  23. 22 Feb, 2018 1 commit
  24. 20 Feb, 2018 2 commits
  25. 20 Jan, 2018 1 commit
  26. 01 Dec, 2017 1 commit
  27. 28 Nov, 2017 1 commit
  28. 27 Nov, 2017 1 commit
    • rswindell's avatar
      Fix a bug in the get_msg_header() method introduced in rev 1.195 (12-Nov-2016): · 28d160e5
      rswindell authored
      The 'expand_fields' argument wasn't be parsed correctly and defaults to 'true',
      so any script that modifies a message header could be writing-back expandeed
      header fields which may sometimes fail depending on how much the total header
      size expanded.
      Enhancement: the put_msg_header() method will now fail with an exception if a
      script tries to write-back a message header that was read with expanded fields.
      This should help to avoid potential message base corruption through a script
      bug.
      28d160e5
  29. 24 Nov, 2017 1 commit
  30. 22 Nov, 2017 1 commit
    • rswindell's avatar
      Fixed bug in JS msgbase.save_msg(), when multiple recipients were · 6f5aa63c
      rswindell authored
      passed (as an array), the message's data blocks would be allocated with a
      refcount of 1, as though only one message header referenced the data. This
      is really only an issue with bulkmail/multiple-recipient email and when the
      first message was deleted, the remaining (headers) would point to free
      data blocks which could and eventually would be overwritten by another
      message's data (body text). chksmb would only catch the problem when the
      refcount reached 0 but there was still one or more message headers pointing
      at the data.
      6f5aa63c
  31. 06 Nov, 2017 1 commit
  32. 01 Nov, 2017 1 commit
    • rswindell's avatar
      Hopefully fix issue with converting auxattr with bit 31 set to/from JS value: · aaa250d1
      rswindell authored
      Poll with results "closed" (only visible to pollster until the poll is closed)
      have bit 31 set in the auxattr message header field. Reportedly (by Nightfox)
      this causes Error: can't convert 2147483648 to an integer when attempting
      to use this message in JS.
      I could'vd sworn I've solved this problem before, but maybe that was with
      JS-C v1.5 - anyway, first convert to double using JS_ValueToNumber and then
      typecast to uint32.
      We probably will need to do something similar with the time values in year
      2038 (holding my breath).
      aaa250d1
  33. 19 Aug, 2017 1 commit
  34. 01 Dec, 2016 1 commit
    • rswindell's avatar
      Error messages logged with errormsg() now contain the name of the C/C++ · b4b6713e
      rswindell authored
      function where the error is being reported from. So the WHERE macro now
      contains the __FUNCTION__ "macro" and the various js*.c files that use the
      WHERE macro to report errors had to be updated too.
      Also, the 'access' argument is now being passed as a signed long rather than
      unsigned long. Status/return values are often passed in here (e.g. from smblib)
      and may be negative. This argument was being displayed with %ld but wasn't
      being passed in as a signed value, so on 64-bit long systems, negative numbers
      were just printed as large (4M+) numbers.
      Also, no need to call getfname() in errormsg() since this is embedded in the
      WHERE macro (since 2009).
      b4b6713e