diff --git a/ChangeLog b/ChangeLog index ab51d82..9b96aaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2013-01-07 Emily Backes lucca@accela.net + + Update to 1.1.0 release. + + Add @vz use to hooks demo code to simplify dbref rewrite. + + Add @trigger based interface for better handling huge jobs on + systems with a small function-invocation limit. + + 2012-01-24 Emily Backes lucca@accela.net Update to 1.0.1 release. diff --git a/README.md b/README.md index 1d9fd91..369a0e8 100644 --- a/README.md +++ b/README.md @@ -6,25 +6,31 @@ This can be used for general forum posting from within the MUX, but is targetted Originally produced for [The Reach](http://thereachmux.org/) -## Primary interfaces: +## Interface +### Function interface * fn_post_new_topic * fn_post_reply * fn_simple_post_new_topic * fn_simple_post_reply * fn_post_job +### Trigger interface +* trig_post_job + ## Compatibility Very little, currently, but feedback and patches are welcome. We have this working with: -* Anomaly Jobs 6.4 + a lot of patches +* Anomaly Jobs 6 * phpBB 3.0 -* TinyMux 2.10 + [a few patches](https://github.com/lashtear/tinymux/tree/thereach) -* MySQL 5.1 +* TinyMux 2.10 +* MySQL 5.1 and 5.5 Source code is provided in the format of the general MUSH unformatter tools that we all use; attributes must be unwrapped before feeding into the MUX. +Loki has been investigating RHOST+SMF compatibility. Patches are quite welcome. + ## Acknowledgements The idea of archiving AJ's completed jobs to a permanent forum was originally [Loki](http://github.com/kkragenbrink)'s (Nuitari@DLAoM), and he completed working versions on DragonLance: Age of Mortals MUSH and [Haunted Memories: Vienna by Night](http://www.haunted-memories.net/) for AJ5 and SMF. diff --git a/hooks.mush b/hooks.mush index 165072e..2eaf4db 100644 --- a/hooks.mush +++ b/hooks.mush @@ -10,11 +10,14 @@ QUIT @vc me=#2621 - -&hook_apr %vc=think ulocal( #5185/fn_post_job, %0 ) +@vz %vc=#5185 - -&hook_dny %vc=think ulocal( #5185/fn_post_job, %0 ) +&hook_apr %vc=@trigger %vz/trig_post_job=%0 - -&hook_com %vc=think ulocal( #5185/fn_post_job, %0 ) +&hook_dny %vc=@trigger %vz/trig_post_job=%0 +- + +&hook_com %vc=@trigger %vz/trig_post_job=%0 - diff --git a/jobs-archive.mush b/jobs-archive.mush index d48445c..7c67fd9 100644 --- a/jobs-archive.mush +++ b/jobs-archive.mush @@ -13,7 +13,7 @@ # fn_simple_post_reply # fn_post_job -# Copyright (c) 2011 Emily Backes +# Copyright (c) 2011-2013 Emily Backes # # All rights reserved. # @@ -57,11 +57,11 @@ QUIT - @desc %va=Functions for posting to PHPBB3 forums using mysql - -©right %va=Copyright (c) 2011 Emily Backes +©right %va=Copyright (c) 2011-2013 Emily Backes - &license %va=BSD 3-Clause - -&version %va=1.0.1 +&version %va=1.1.0 - # conf prefix of forum tables @@ -708,6 +708,58 @@ QUIT %qt ))))) - +# takes +# DBREF of job + +&trig_post_job %va= +@assert + setr( e, + switch( 1, + not( isdbref( %0 )), #-1 Invalid job DBREF, + not( strmatch( name( %0 ), Job* )), #-1 Not a job, + not( strmatch( xget( setr(p, parent( parent( %0 ))), vc ), %qp )), + #-1 Not in a bucket, + not( strmatch( name( %qp ), *Job Parent Object* )), #-1 Invalid JPO, + strcat( + setq( u, ulocal( %va/fn_get_user_id, default(%!/CONF_FORUM_USER, +jobs) )), + setq( f, ulocal( %va/fn_get_forum_id, lcstr( name( parent( %0 ))))), + switch( %qu|%qf, + #-1*|*, #-1 Unable to locate +jobs user, + *|#-1*, #-1 Unknown to locate bucket forum, + 1 ))))=@pemit %#= trig_post_job setup returned %qe; + +@assert + setr( t, + ulocal( %va/fn_post_new_topic, + %qu, + %qf, + strtrunc( get( %0/title ), 96 ), + ulocal( %va/fn_summarize_job, %0 ), + get( %0/opened_on )))=@pemit %#= trig_post_job topic post returned %qe; + +@dol lnum( 1, dec( get( %0/num_comment )))={ +think setq( c, get( %0/comment_## )); +think iter( lnum( 1, 5 ), setq( %i0, index( %qc, |, %i0, 1 ))); +think iter( 1 2, + strcat( + setq( p, + mid( %q5, + mul( ulocal( %va/conf_lbuf_div2 ), dec( %i0 )), + ulocal( %va/conf_lbuf_div2 ))), + if( or( strlen( %qp ), not( dec( %i0 ))), + ulocal( %va/fn_post_reply, + %qu, + %qt, + strcat( + if( gt( strlen( %q5 ), ulocal( %va/conf_lbuf_div2 )), + This post was larger than half LBUF size and + is split into two pieces. This is part %i0 of 2.), + ulocal( %va/fn_summarize_job_entry, + %0, %q1, %q2, %q3, %q4, %qp, ## )), + %q2)))) +} +- + # takes # list of DBREFs # returns list of names, english style