tree checksum vpatch file split hunks

all signers: ben_vulpes

antecedents: logbot-genesis

press order:

logbot-genesis
logbot-multiple-channels-correctedben_vulpes

patch:

- 34C09AAE0020F81B9DD9A9120DAE84C0E996B578041E837785E814409F69D0D587A21C0C1454C6E39039C8CA3FD135092D4EFD006F39F0E47AC87F0314F6F92D
+ 19835DE2EBF3DC6A70796058BA4A79A4E4CF17CA993B73A97E821A0056D717285F5D1E3A40ECC0EF03EFD1FDFAEEED7B5ED2FB43113866CB12B849091753B5CB
logbot/logbot.lisp
(1 . 17)(1 . 17)
5 (in-package #:logbot)
6
7
8 (defun get-and-purge-outbox-messages (db)
9 (defun get-and-purge-outbox-messages (db target)
10 (postmodern:with-connection db
11 (postmodern:query
12 "with deleted as (
13 delete from outbox
14 returning target, message, queued_at
15 where target = $1
16 returning message, queued_at
17 )
18 select target,
19 message
20 select message
21 from deleted
22 order by queued_at"
23 order by queued_at" target
24 :rows)))
25
26 (defun make-log-entry (db target message host source user)
(31 . 7)(31 . 7)
28 (db :reader logbot-db :initarg :db)))
29
30 (defmethod ircbot-connect :after ((bot logbot))
31 (let ((conn (ircbot-connection bot)))
32 (let ((conn (ircbot-connection bot)))
33 (add-hook conn 'irc-mode-message (lambda (message)
34 (logbot-check-mode bot message)))
35 (add-hook conn 'irc-privmsg-message (lambda (message)
(57 . 18)(57 . 18)
37 (if (= 3 (length (arguments message)))
38 (destructuring-bind (channel mode nick) (arguments message)
39 (when (and (string= (host message) "services.")
40 (string= channel (ircbot-channel bot))
41 (member channel (ircbot-channels bot) :test #'string=)
42 (or (string= mode "+o") (string= mode "+v"))
43 (string= nick (ircbot-nick bot)))
44
45 (when (null (logbot-pg-thread bot))
46 (logbot-start-pg-thread bot)
47 (logbot-send-outbox bot))))))
48 (logbot-send-outbox bot channel))))))
49
50 (defmethod logbot-send-outbox ((bot logbot))
51 (defmethod logbot-send-outbox ((bot logbot) target)
52 (loop
53 for (target message)
54 in (get-and-purge-outbox-messages (logbot-db bot))
55 for (message)
56 in (get-and-purge-outbox-messages (logbot-db bot) target)
57 do (ircbot-send-message bot target message)))
58
59 (defmethod logbot-start-pg-thread ((bot logbot))
(78 . 16)(78 . 19)
61 (postmodern:with-connection (logbot-db bot)
62 (postmodern:execute "listen outbox_new_message")
63 (loop
64 (if (string= (cl-postgres:wait-for-notification postmodern:*database*)
65 "outbox_new_message")
66 (logbot-send-outbox bot)))))
67 (multiple-value-bind (channel payload pid)
68 (cl-postgres:wait-for-notification postmodern:*database*)
69 (declare (ignore pid))
70 (if (string= channel
71 "outbox_new_message")
72 (logbot-send-outbox bot payload))))))
73 :name "logbot-pg")))
74
75 (defun make-logbot (server port nick password channel db)
76 (defun make-logbot (server port nick password channels db)
77 (make-instance 'logbot
78 :server server
79 :port port
80 :nick nick
81 :password password
82 :channel channel
83 :channels channels
84 :db db))
- DBC265A63C34C6B682694C8776AA4640C83BA92DCA5400F0BD393F6A9EB5D3672011C234C3D04A7AD074F3FCE560D71D78201F4BBCB506C12ED6CC90D3C59017
+ 83BD0BA610A945CA03644BB5EA7304AC61D04622920C42DEA741EAE7AD22C10F6A2B00994832898F6706D2B1608A23ACC26FC2AF1CAE17837EE7739EAE36797E
logbot/logbot.sql
(28 . 7)(28 . 7)
89 create trigger log_insert_notify_trigger
90 after insert on log
91 for each row execute procedure log_insert_notify ();
92
93
94 create table outbox (
95 id serial primary key,
96 target text not null,
(38 . 7)(38 . 7)
98
99 create or replace function outbox_insert_notify () returns trigger as $$
100 begin
101 perform pg_notify('outbox_new_message', NEW.id::text);
102 perform pg_notify('outbox_new_message', NEW.target::text);
103 return NEW;
104 end;
105 $$ language plpgsql;
- 29A3142E5A5A5B814921B49C16571B2D0359CDCA2DFDC9CA4463734F066B1E087A4ECECB6341F1667EF26F6A97B0B8CE326CEDAF2539D2CFD64CA4C3FB6551DF
+ ED9E56E8BDCCA12FA144C095493602FF389977ED28CF6DF0185B474EEFD151CC0FE211824D7DE480D4499A9C013144EAD41CC962A8B96DEA7B84B2F68BAB3569
logbot/package.lisp
(11 . 10)(11 . 9)
110 :ircbot-disconnect
111 :ircbot-reconnect
112 :ircbot-connection
113 :ircbot-channel
114 :ircbot-channels
115 :ircbot-send-message
116 :ircbot-server
117 :ircbot-port
118 :ircbot-nick
119 :ircbot-lag))
120