mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-23 18:54:05 +01:00
Merge branch 'devel' into wip/p10
This commit is contained in:
commit
fccfb62609
@ -1,27 +1,27 @@
|
|||||||
|
/* Graph for the PyLink Application Structure:
|
||||||
|
* Update using: dot -Tpng core-structure.dot > core-structure.png
|
||||||
|
*/
|
||||||
|
|
||||||
digraph G {
|
digraph G {
|
||||||
ratio = 1.3;
|
ratio = 0.8; /* make the graph wider than tall */
|
||||||
subgraph cluster_core {
|
subgraph cluster_core {
|
||||||
label="PyLink Application Structure";
|
label="PyLink Application Structure";
|
||||||
style="filled";
|
style="filled";
|
||||||
node [style="filled",color="white"];
|
node [style="filled",color="white"];
|
||||||
color="lightblue";
|
color="lightblue";
|
||||||
subgraph cluster_testsuite {
|
|
||||||
label="Test Suite API";
|
"IRC objects" -> "Protocol modules" [label="Data relayed"]
|
||||||
style="filled";
|
"Protocol modules" -> "PyLink hooks" -> Plugins;
|
||||||
node [style="filled",color="white"];
|
"IRC objects" -> "PyLink hooks";
|
||||||
color=moccasin;
|
"Main program" -> "IRC objects" [color=indigo] [label="One per network\nspawned"] [fontcolor=indigo];
|
||||||
"Dummy protocol\nmodule" -> "Dummy IRC\nobject (FakeIRC)" [color=darkgreen];
|
"Main program" -> "IRC objects" [color=indigo];
|
||||||
"Dummy IRC\nobject (FakeIRC)" -> "Dummy protocol\nmodule" [color=darkgreen];
|
"Main program" -> "IRC objects" [color=indigo];
|
||||||
|
"Protocol modules" -> "IRC objects" [label="States updated"] [color=darkgreen] [fontcolor=darkgreen];
|
||||||
|
"Main program" -> Plugins [label="Plugin loaders"];
|
||||||
}
|
}
|
||||||
|
|
||||||
"IRC object" -> "Protocol module" -> "PyLink hooks" -> Plugins;
|
"Protocol modules" -> "IRCds" -> "Protocol modules";
|
||||||
"Main program" -> "IRC object" [color=indigo] [label="Spawns 1/net"] [fontcolor=indigo];
|
Plugins -> "Protocol modules" [label="Communication via\nIRC command\nsenders"] [color=navyblue] [fontcolor=navyblue];
|
||||||
"Main program" -> "Dummy IRC\nobject (FakeIRC)" [color=darkgreen] [label="(test suite runner)"] [fontcolor=darkgreen];
|
|
||||||
}
|
|
||||||
|
|
||||||
"Protocol module" -> "Remote IRCd" -> "Protocol module";
|
|
||||||
Plugins -> "Protocol module" [label="Communicates \nvia*Client/*Server\nfunctions"] [color=navyblue] [fontcolor=navyblue];
|
|
||||||
Plugins -> "Main program" [label="Registers commands\n& hook handlers"] [color=brown] [fontcolor=brown];
|
Plugins -> "Main program" [label="Registers commands\n& hook handlers"] [color=brown] [fontcolor=brown];
|
||||||
"Dummy protocol\nmodule" -> "PyLink hooks" [color=darkgreen];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 56 KiB |
@ -112,23 +112,23 @@ When receiving or sending topics, there is a `topicset` attribute in the IRC cha
|
|||||||
|
|
||||||
### Mode formats
|
### Mode formats
|
||||||
|
|
||||||
Modes are stored a special format in PyLink, different from raw mode strings in order to make them easier to parse. Mode strings can be turned into mode *lists*, which are used to both represent mode changes in hooks, and when storing them internally.
|
Modes are stored a special format in PyLink, different from raw mode strings in order to make them easier to parse. Mode strings can be turned into mode *lists*, which are used to represent mode changes in hooks, and when storing modes internally.
|
||||||
|
|
||||||
`utils.parseModes(irc, target, split_modestring)` is used to convert mode strings to mode lists, where `irc` is the IRC object, `target` is the channel or user the mode is being set on, and `split_modestring` is the string of modes to parse, *split at each space* (really a list).
|
`utils.parseModes(irc, target, split_modestring)` is used to convert mode strings to mode lists, where `irc` is the IRC object, `target` is the channel name or UID the mode is being set on, and `split_modestring` is the string of modes to parse, *split at each space* (meaning that it's really a list).
|
||||||
|
|
||||||
- `utils.parseModes(irc, '#chat', ['+tHIs', '*!*@is.sparta'])` would give:
|
- `utils.parseModes(irc, '#chat', ['+tHIs', '*!*@is.sparta'])` would give:
|
||||||
- `[('+t', None), ('+H', None), ('+I', '*!*@is.sparta'), ('+s', None)]`
|
- `[('+t', None), ('+H', None), ('+I', '*!*@is.sparta'), ('+s', None)]`
|
||||||
|
|
||||||
Also, it will automatically convert prefix mode targets from nicks to UIDs, and drop invalid modes
|
Also, `parseModes` will automatically convert prefix mode targets from nicks to UIDs, and drop invalid modes settings.
|
||||||
|
|
||||||
- `utils.parseModes(irc, '#chat', ['+ol', 'invalidnick'])`:
|
- `utils.parseModes(irc, '#chat', ['+ol', 'invalidnick'])`:
|
||||||
- `[]`
|
- `[]`
|
||||||
- `utils.parseModes(irc, '#chat', ['+o', 'GLolol'])`:
|
- `utils.parseModes(irc, '#chat', ['+o', 'GLolol'])`:
|
||||||
- `[('+o', '001ZJZW01')]`
|
- `[('+o', '001ZJZW01')]`
|
||||||
|
|
||||||
Then, the parsed mode lists can be applied to channel using `utils.applyModes(irc, target, parsed_modelist)`.
|
Then, a parsed mode list can be applied to channel name or UID using `utils.applyModes(irc, target, parsed_modelist)`.
|
||||||
|
|
||||||
Modes are stored in channels and users as sets: `(userobj or chanobj).modes`:
|
Internally, modes are stored in channel and user objects as sets: `(userobj or chanobj).modes`:
|
||||||
|
|
||||||
```
|
```
|
||||||
<+GLolol> PyLink-devel, eval irc.users[source].modes
|
<+GLolol> PyLink-devel, eval irc.users[source].modes
|
||||||
@ -141,7 +141,7 @@ Modes are stored in channels and users as sets: `(userobj or chanobj).modes`:
|
|||||||
|
|
||||||
```
|
```
|
||||||
<@GLolol> PyLink-devel, eval irc.channels['#chat'].prefixmodes
|
<@GLolol> PyLink-devel, eval irc.channels['#chat'].prefixmodes
|
||||||
<+PyLink-devel> {'ops': set(), 'halfops': set(), 'voices': {'38QAAAAAA'}, 'owners': set(), 'admins': set()}
|
<+PyLink-devel> {'op': set(), 'halfop': set(), 'voice': {'38QAAAAAA'}, 'owner': set(), 'admin': set()}
|
||||||
```
|
```
|
||||||
|
|
||||||
When a certain mode (e.g. owner) isn't supported on a network, the key still exists in `prefixmodes` but is simply unused.
|
When a certain mode (e.g. owner) isn't supported on a network, the key still exists in `prefixmodes` but is simply unused.
|
||||||
|
@ -481,6 +481,10 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
else:
|
else:
|
||||||
channel = utils.toLower(self.irc, args[1])
|
channel = utils.toLower(self.irc, args[1])
|
||||||
self.updateTS(channel, ts)
|
self.updateTS(channel, ts)
|
||||||
|
|
||||||
|
self.irc.users[numeric].channels.add(channel)
|
||||||
|
self.irc.channels[channel].users.add(numeric)
|
||||||
|
|
||||||
# We send users and modes here because SJOIN and JOIN both use one hook,
|
# We send users and modes here because SJOIN and JOIN both use one hook,
|
||||||
# for simplicity's sake (with plugins).
|
# for simplicity's sake (with plugins).
|
||||||
return {'channel': channel, 'users': [numeric], 'modes':
|
return {'channel': channel, 'users': [numeric], 'modes':
|
||||||
|
Loading…
Reference in New Issue
Block a user