Changeset d7cdc2a5ba4c3c54166d6bda982334dbc4e7de00
- Timestamp:
- 03/15/10 00:08:48 (5 months ago)
- Author:
- Robin H. Johnson <robbat2@…>
- Children:
- 6d112bb9364e9329806c90f116ac30e3f1437a0c
- Parents:
- eb3e6265ef371eda4594f59c872fbb68e1998441
- git-author:
- Robin H. Johnson <robbat2@gentoo.org> 1268473477 +0000
- git-committer:
- Robin H. Johnson <robbat2@gentoo.org> 1268600928 +0000
- Message:
-
seen: Introduce framework for message and channel privacy.
This commit introduces the ability to note that a user was doing
something, optionally without disclosing what or where it was.
Users themselves do not get the chance to be hidden, because you can ask
the /WHOIS service if they logged on at all.
Signed-off-by: Robin H. Johnson <robbat2@…>
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
reb3e626
|
rd7cdc2a
|
|
| 9 | 9 | |
| 10 | 10 | class SeenPlugin < Plugin |
| | 11 | |
| | 12 | MSG_PUBLIC = N_("saying \"%{message}\" in %{where}") |
| | 13 | MSG_ACTION = N_("doing *%{nick} %{message}* in %{where}") |
| | 14 | MSG_NICK = N_("changing nick from %{nick} to %{message}") |
| | 15 | MSG_PART = N_("leaving %{where} (%{message})") |
| | 16 | MSG_PART_EMPTY = N_("leaving %{where}") |
| | 17 | MSG_JOIN = N_("joining %{where}") |
| | 18 | MSG_QUIT = N_("quitting IRC (%{message})") |
| | 19 | MSG_TOPIC = N_("changing the topic of %{where} to \"%{message}\"") |
| | 20 | |
| | 21 | CHANPRIV_CHAN = N_("a private channel") |
| | 22 | CHANPRIV_MSG_TOPIC = N_("changing the topic of %{where}") |
| | 23 | |
| | 24 | MSGPRIV_MSG_PUBLIC = N_("speaking in %{where}") |
| | 25 | MSGPRIV_MSG_ACTION = N_("doing something in %{where}") |
| | 26 | |
| | 27 | FORMAT_NORMAL = N_("%{nick} was last seen %{when}, %{doing}") |
| | 28 | FORMAT_WITH_BEFORE = N_("%{nick} was last seen %{when}, %{doing} and %{time} before %{did_before}") |
| | 29 | |
| 11 | 30 | Config.register Config::IntegerValue.new('seen.max_results', |
| 12 | 31 | :default => 3, :validate => Proc.new{|v| v >= 0}, |
| … |
… |
|
| 86 | 105 | end |
| 87 | 106 | |
| | 107 | # TODO: a message should not be disclosed if: |
| | 108 | # - it was said in a channel that was/is invite-only, private or secret |
| | 109 | # - UNLESS the requester is also in the channel now, or the request is made |
| | 110 | # in the channel? |
| | 111 | msg_privacy = false |
| | 112 | # TODO: a channel or it's topic should not be disclosed if: |
| | 113 | # - the channel was/is private or secret |
| | 114 | # - UNLESS the requester is also in the channel now, or the request is made |
| | 115 | # in the channel? |
| | 116 | chan_privacy = false |
| | 117 | |
| | 118 | # What should be displayed for channel? |
| | 119 | where = chan_privacy ? _(CHANPRIV_CHAN) : saw.where |
| | 120 | |
| 88 | 121 | formats = { |
| 89 | | :normal => _("%{nick} was last seen %{when}, %{doing}"), |
| 90 | | :with_before => _("%{nick} was last seen %{when}, %{doing} and %{time} before %{did_before}") |
| | 122 | :normal => _(FORMAT_NORMAL), |
| | 123 | :with_before => _(FORMAT_WITH_BEFORE) |
| 91 | 124 | } |
| 92 | 125 | |
| … |
… |
|
| 95 | 128 | did_before = case before.type.to_sym |
| 96 | 129 | when :PUBLIC |
| 97 | | _("saying \"%{message}\"") |
| | 130 | _(msg_privacy ? MSGPRIV_MSG_PUBLIC : MSG_PUBLIC) |
| 98 | 131 | when :ACTION |
| 99 | | _("doing *%{nick} %{message}*") |
| | 132 | _(msg_privacy ? MSGPRIV_MSG_ACTION : MSG_ACTION) |
| 100 | 133 | end % { |
| 101 | 134 | :nick => saw.nick, |
| 102 | | :message => before.message |
| | 135 | :message => before.message, |
| | 136 | :where => where |
| 103 | 137 | } |
| 104 | 138 | |
| … |
… |
|
| 128 | 162 | doing = case saw.type.to_sym |
| 129 | 163 | when :PUBLIC |
| 130 | | _("saying \"%{message}\" in %{where}") |
| | 164 | _(msg_privacy ? MSGPRIV_MSG_PUBLIC : MSG_PUBLIC) |
| 131 | 165 | when :ACTION |
| 132 | | _("doing *%{nick} %{message}* in %{where}") |
| | 166 | _(msg_privacy ? MSGPRIV_MSG_ACTION : MSG_ACTION) |
| 133 | 167 | when :NICK |
| 134 | | _("changing nick from %{nick} to %{message}") |
| | 168 | _(MSG_NICK) |
| 135 | 169 | when :PART |
| 136 | 170 | if saw.message.empty? |
| 137 | | _("leaving %{where}") |
| | 171 | _(MSG_PART_EMPTY) |
| 138 | 172 | else |
| 139 | | _("leaving %{where} (%{message})") |
| | 173 | _(MSG_PART) |
| 140 | 174 | end |
| 141 | 175 | when :JOIN |
| 142 | | _("joining %{where}") |
| | 176 | _(MSG_JOIN) |
| 143 | 177 | when :QUIT |
| 144 | | _("quitting IRC (%{message})") |
| | 178 | _(MSG_QUIT) |
| 145 | 179 | when :TOPIC |
| 146 | | _("changing the topic of %{where} to \"%{message}\"") |
| 147 | | end % { :message => saw.message, :where => saw.where, :nick => saw.nick } |
| | 180 | _(chan_privacy ? CHANPRIV_MSG_TOPIC : MSG_TOPIC) |
| | 181 | end % { :message => saw.message, :where => where, :nick => saw.nick } |
| 148 | 182 | |
| 149 | 183 | case format |
| … |
… |
|
| 166 | 200 | |
| 167 | 201 | def store(m, saw) |
| | 202 | # TODO: we need to store the channel state INVITE/SECRET/PRIVATE here, in |
| | 203 | # some symbolic form, so that we know the prior state of the channel when |
| | 204 | # it comes time to display. |
| 168 | 205 | reg = @registry[saw.nick] |
| 169 | 206 | |