From bce0e4f5a0e0d1bd72c5511cb284ee8e334ccd18 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 27 Feb 2012 17:17:22 -0800 Subject: [PATCH] add gnot plugin --- gnot.tgz | Bin 0 -> 1388 bytes gnot/gnot.css | 16 ++++++++ gnot/gnot.php | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 gnot.tgz create mode 100755 gnot/gnot.css create mode 100755 gnot/gnot.php diff --git a/gnot.tgz b/gnot.tgz new file mode 100644 index 0000000000000000000000000000000000000000..fbf7f26721022228eadac4aecc59b449694cc4a9 GIT binary patch literal 1388 zcmV-y1(W(8iwFP%D@;!S1MOFTZ`(Ey&A;}ixT#rX7l~y%aZ)&Of}(4?0ZmdM!G<9% z3|gXOHWDdNl#^iHci$Z)*;dmc-H)^bszYpq)bV(H_wG@Sq%z*d!&)D0e}A+w9PRE8 zhr1j7(cW-xcVOpB+ZYV?hdce@Xo!A&9PI3E!03VVvX*CtX@HG{`H|2IAwT1nMx(vK z)2C0rMowSRBC0=q_53V*pgr!Z|FA!*>c2A>Q2lpy`&j?}1Lae*@4Wu)M^yanfM-7Z z(QYM7M?!ATlrbt9!=Rtu9JK#zmtHZO@tEAgSTQq(n1|+|-MSWmnU7)Ex85Je7>?Fs z+*yqe+TR+4@7PxTpU%?<+T))7AMFg*^?%p)|6srA|F2<($5{8a_vA?%p1>(f_!wRx z8))$${NSI5;t}T3 zrv!jlJQWh_8ONP23QfDEc_cE!^>nV(RmV-^9F=LBabtvxGItAH76eLqwJxA(8*Ay; zJ-9E_G*y}T(s+gQCxUVd=TEsCV42hrR8i(9naES1BWUyed2q4e62Il)Jm$nzFr9=ps zqRm0&n)V1qlxy33RZ0*ljhhNg4ZE$#sc4gW`D@^IHrbZVo2bwdVdn>kmCxcSC4v0- z@Bwh@rc)eb%i_76<+DU!UAoVWCEq(dvL^E6JZU2D$@V9T#u4ZDwv`p3OPdacw^;?KKCV$$}Tw zvq~;Tx`Pxxw+Xd2+4d2wxpe0yiRY-x?mOsBz&(tGyaLVRiL=_p0Wh~IpE!o!7!Tj_ z9Y8G)Cyt9iQm6=PHe(sjHK{=lT<_yX!bRllI*{-{u!)0EJK!DBr1Mt4l}>raS9B;m zk)LZ#7X(U-!Lx*Gj75TLK^!R0VqXd;Q1T)ALjH8E;@QPhf6o0Yto#Hz9Xr#7V{oCI zo;c+{4$h6ib%98>tVpI34nJRx2EHD*=&zI6j5FUE;_@EwCV3xM4t~E=sbDht7(2KfL#&@2@vAQOep}U!KMx_7t z4NdE;s^zoy+&6$6;ytHK7Wb~@Qv3o~W@CpAK~+ptnYk})nMx_LjaZQCxI)3Mtc4ab z&CM#b9Xcg-Z3$=U#sP`1DCJ%xl{pRuj@tvMbAeb~i*8S{UO_+R41r!A(J}&GGZrG? zD8q%m!7RrgG4g&I6z + * + * + */ + + +function gnot_install() { + + register_hook('plugin_settings', 'addon/gnot/gnot.php', 'gnot_settings'); + register_hook('plugin_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post'); + register_hook('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail'); + + logger("installed gnot"); +} + + +function gnot_uninstall() { + + unregister_hook('plugin_settings', 'addon/gnot/gnot.php', 'gnot_settings'); + unregister_hook('plugin_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post'); + unregister_hook('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail'); + + + logger("removed gnot"); +} + + + +/** + * + * Callback from the settings post function. + * $post contains the $_POST array. + * We will make sure we've got a valid user account + * and if so set our configuration setting for this person. + * + */ + +function gnot_settings_post($a,$post) { + if(! local_user() || (! x($_POST,'gnot-submit'))) + return; + + set_pconfig(local_user(),'gnot','enable',intval($_POST['gnot'])); + info( t('Gnot settings updated.') . EOL); +} + + +/** + * + * Called from the Plugin Setting form. + * Add our own settings info to the page. + * + */ + + + +function gnot_settings(&$a,&$s) { + + if(! local_user()) + return; + + /* Add our stylesheet to the page so we can make our settings look nice */ + + $a->page['htmlhead'] .= '' . "\r\n"; + + /* Get the current state of our config variable */ + + $gnot = intval(get_pconfig(local_user(),'gnot','enable')); + + $gnot_checked = (($gnot) ? ' checked="checked" ' : '' ); + + /* Add some HTML to the existing form */ + + $s .= '
'; + $s .= '

' . t('Gnot Settings') . '

'; + $s .= '
'; + $s .= '
' . t("Allows threading of email comment notifications on Gmail and anonymising the subject line.") . '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + /* provide a submit button */ + + $s .= '
'; + +} + + +function gnot_enotify_mail(&$a,&$b) { + if((! $b['uid']) || (! intval(get_pconfig($b['uid'], 'gnot','enable')))) + return; + if($b['type'] == NOTIFY_COMMENT) + $b['subject'] = sprintf( t('[Friendica:Notify] Comment to conversation #%d'), $b['parent']); +} + -- 2.39.5