1. 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
  2. 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
  3. 18 Feb, 2019 1 commit
  4. 16 Feb, 2019 1 commit
  5. 22 Jan, 2019 1 commit
  6. 21 Jan, 2019 1 commit
  7. 03 Oct, 2018 1 commit
  8. 06 Sep, 2018 1 commit
  9. 16 Jul, 2018 1 commit
  10. 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
  11. 10 Mar, 2018 1 commit
  12. 22 Feb, 2018 1 commit
  13. 20 Feb, 2018 2 commits
  14. 20 Jan, 2018 1 commit
  15. 01 Dec, 2017 1 commit
  16. 28 Nov, 2017 1 commit
  17. 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
  18. 24 Nov, 2017 1 commit
  19. 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
  20. 06 Nov, 2017 1 commit
  21. 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
  22. 19 Aug, 2017 1 commit
  23. 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
  24. 22 Nov, 2016 1 commit
  25. 21 Nov, 2016 4 commits
    • rswindell's avatar
      Change MsgBase.get_user_votes() to MsgBase.how_user_voted(). · 0b984ab1
      rswindell authored
      New MsgBase header propeties:
      - total_votes (total number of votes this msg or poll has received)
      - tally[], an array of 16 numbers indicating the total votes for each poll answer
        in the case of a normal message, tally[0] is the same as upvotes and tally[1]
        is the same as downvotes.
      This should complete what echicken needs to display polls and voting results
      in his web UI.
      0b984ab1
    • rswindell's avatar
      Handle poll-closures correctly (don't treat as votes in get_msg_index and · e5dde404
      rswindell authored
      get_all_msg_headers).
      Added new method: get_user_votes(msg number, user name or alias)
      The user name or alias must match the posting configuration on the local
      system (i.e. if set for real names, pass the user's real name instead of alias).
      This function returns 0 for no votes on the reference message, 1 for an
      up-vote, 2 for a down-vote or in the case of a poll-response, a bit-field of
      votes.
      e5dde404
    • rswindell's avatar
      Add the "votes" header property. · bb6a507f
      rswindell authored
      On polls, this is the maximum number of votes per ballot in response to this
      poll (0 is the same as 1).
      On ballots, this is the bit-field of votes submitted by the user (e.g. bit 0
      set is a vote for answer 1, bit 1 for answer 2, etc.).
      For normal messages, this field has no current use.
      bb6a507f
    • rswindell's avatar
  26. 19 Nov, 2016 1 commit
  27. 16 Nov, 2016 1 commit
  28. 15 Nov, 2016 1 commit
  29. 13 Nov, 2016 2 commits
    • rswindell's avatar
      MsgBase.get_all_msg_headers() now returns the vote totals for each message · e4df751e
      rswindell authored
      (new header properties: upvotes and downvotes), regardless of the
      "include_votes" argument value (default: false).
      get_all_msg_headers() reads the entire index already, so there's really no
      performance penalty unless there are actual votes (and even then, very low).
      The MsgBase.get_msg_header() function will *not* return these vote totals since
      that would incur a pretty substatial performance hit on that function.
      e4df751e
    • rswindell's avatar
      Add new MsgBase method: vote_msg(). it takes a message header object · cd4c51bb
      rswindell authored
      (like save_msg), except you only need a few properties, in order of importarnce:
      attr: you need to have this set to MSG_UPVOTE, MSG_DOWNVOTE, or MSG_VOTE
      thread_back or reply_id: either of these must be set to indicate msg to vote on
      from: name of voter
      from_net_type and from_net_addr: if applicable
      cd4c51bb
  30. 12 Nov, 2016 1 commit
    • rswindell's avatar
      MsgBase methods now exclude vote messages by default: · 294cd729
      rswindell authored
      - get_msg_index()
      - get_msg_header()
      - get_all_msg_headers()
      these functions all accept a new (optonal, last) bool argument "include_votes"
      which defaults to false. So if for some reason, you want to load votes, just
      pass an additional 'true' argument.
      ToDo: polls and vote tallying.
      At least for now, existing JS stuff that uses the MsgBase object won't get
      messed up by the new voting messages.
      294cd729
  31. 03 Dec, 2015 1 commit
    • rswindell's avatar
      Bug-fix/enhancement: Allow QWKnet netmail to be sent using the JavaScript · d2892791
      rswindell authored
      MsgBase.save_msg() method. The bug was that it was forcing the idx.to value to
      0 which would only work (in theory) for mail going to a QWKnet hub.
      Now, save_msg() will check the 'to_net_addr' property of the header object
      (or recipient objects) and actually verify that it/they are routeable QWKnet
      address(es) and throw an exception if not.
      If the first hop is a QWKnet node, sets the to_ext (and thus, idx.to value) to
      the account number of the node. This also looks up full-routes via the
      route.dat and replaces the to_net_addr value with the full route if necessary.
      I guess nobody (including me) tried sending QWKnet netmail via JS before.
      d2892791
  32. 26 Nov, 2015 1 commit
    • rswindell's avatar
      Make the SMB plain-text only feature available to users of the · 83cd7103
      rswindell authored
      MsgBase.get_msg_body() method: added an additional boolean argument (following
      the 'include_tails' argument), which defaults to false (disabled). Pass true
      for this argument to enable this feature. Yes, JS-authors could do this parsing
      easily via JS, but I figure so long as this feature is in the SMBLIB, might as
      well expose it to JS for consistency (e.g. in 3rd party message reader mods).
      83cd7103
  33. 23 Nov, 2015 2 commits
  34. 28 Oct, 2015 1 commit