Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
poezio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Maxime Buquet
poezio
Commits
7a1b2b98
Unverified
Commit
7a1b2b98
authored
Apr 28, 2019
by
Maxime Buquet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugins: Update use of tab.name to tab.jid where appropriate
Signed-off-by:
Maxime “pep” Buquet
<
pep@bouah.net
>
parent
200f2294
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
34 additions
and
28 deletions
+34
-28
plugins/dice.py
plugins/dice.py
+1
-1
plugins/irc.py
plugins/irc.py
+1
-1
plugins/marquee.py
plugins/marquee.py
+1
-1
plugins/otr.py
plugins/otr.py
+9
-9
plugins/ping.py
plugins/ping.py
+7
-3
plugins/reorder.py
plugins/reorder.py
+1
-1
plugins/replace.py
plugins/replace.py
+2
-2
plugins/server_part.py
plugins/server_part.py
+2
-2
plugins/tell.py
plugins/tell.py
+1
-1
plugins/time_marker.py
plugins/time_marker.py
+3
-3
plugins/vcard.py
plugins/vcard.py
+6
-4
No files found.
plugins/dice.py
View file @
7a1b2b98
...
...
@@ -95,7 +95,7 @@ class Plugin(BasePlugin):
is_muctab
=
isinstance
(
tab
,
tabs
.
MucTab
)
msg_id
=
tab
.
last_sent_message
[
"id"
]
increment
=
self
.
config
.
get
(
'refresh'
)
roll
=
DiceRoll
(
duration
,
num_dice
,
is_muctab
,
tab
.
name
,
msg_id
,
roll
=
DiceRoll
(
duration
,
num_dice
,
is_muctab
,
tab
.
jid
,
msg_id
,
increment
)
event
=
self
.
api
.
create_delayed_event
(
increment
,
self
.
delayed_event
,
roll
)
...
...
plugins/irc.py
View file @
7a1b2b98
...
...
@@ -376,7 +376,7 @@ class Plugin(BasePlugin):
"""
gateway
=
self
.
config
.
get
(
'gateway'
,
'irc.poez.io'
)
current
=
self
.
api
.
current_tab
()
current_jid
=
c
ommon
.
safeJID
(
current
.
name
)
current_jid
=
c
urrent
.
jid
if
not
current_jid
.
server
==
gateway
:
self
.
api
.
information
(
'The current tab does not appear to be an IRC one'
,
'Warning'
)
...
...
plugins/marquee.py
View file @
7a1b2b98
...
...
@@ -68,7 +68,7 @@ class Plugin(BasePlugin):
tab
.
command_say
(
args
)
is_muctab
=
isinstance
(
tab
,
tabs
.
MucTab
)
msg_id
=
tab
.
last_sent_message
[
"id"
]
jid
=
tab
.
name
jid
=
tab
.
jid
event
=
self
.
api
.
create_delayed_event
(
self
.
config
.
get
(
"refresh"
),
self
.
delayed_event
,
jid
,
args
,
msg_id
,
...
...
plugins/otr.py
View file @
7a1b2b98
...
...
@@ -325,7 +325,7 @@ def hl(tab):
if
tab
.
state
!=
'current'
:
tab
.
state
=
'private'
conv_jid
=
safeJID
(
tab
.
name
)
conv_jid
=
tab
.
jid
if
'private'
in
config
.
get
(
'beep_on'
,
'highlight private'
).
split
():
if
not
config
.
get_by_tabname
(
'disable_beep'
,
conv_jid
.
bare
,
default
=
False
):
...
...
@@ -806,7 +806,7 @@ class Plugin(BasePlugin):
On message sent
"""
name
=
tab
.
name
jid
=
safeJID
(
tab
.
name
)
jid
=
tab
.
jid
format_dict
=
{
'jid_c'
:
'
\x19
%s}'
%
dump_tuple
(
get_theme
().
COLOR_MUC_JID
),
...
...
@@ -846,7 +846,7 @@ class Plugin(BasePlugin):
elif
not
is_relevant
(
tab
)
and
ctx
and
(
ctx
.
state
==
STATE_ENCRYPTED
or
ctx
.
getPolicy
(
'REQUIRE_ENCRYPTION'
)):
contact
=
roster
[
tab
.
nam
e
]
contact
=
roster
[
tab
.
jid
.
bar
e
]
res
=
[]
if
contact
:
res
=
[
resource
.
jid
for
resource
in
contact
.
resources
]
...
...
@@ -884,13 +884,13 @@ class Plugin(BasePlugin):
return
self
.
core
.
command
.
help
(
'otr'
)
action
=
args
.
pop
(
0
)
tab
=
self
.
api
.
current_tab
()
name
=
tab
.
name
name
=
tab
.
jid
.
full
format_dict
=
{
'jid_c'
:
'
\x19
%s}'
%
dump_tuple
(
get_theme
().
COLOR_MUC_JID
),
'info'
:
'
\x19
%s}'
%
dump_tuple
(
get_theme
().
COLOR_INFORMATION_TEXT
),
'normal'
:
'
\x19
%s}'
%
dump_tuple
(
get_theme
().
COLOR_NORMAL_TEXT
),
'jid'
:
name
,
'bare_jid'
:
safeJID
(
name
).
bare
'jid'
:
tab
.
jid
.
full
,
'bare_jid'
:
tab
.
jid
.
bare
,
}
if
action
==
'end'
:
# close the session
...
...
@@ -991,12 +991,12 @@ class Plugin(BasePlugin):
question
=
secret
=
None
tab
=
self
.
api
.
current_tab
()
name
=
tab
.
name
name
=
tab
.
jid
.
full
format_dict
=
{
'jid_c'
:
'
\x19
%s}'
%
dump_tuple
(
get_theme
().
COLOR_MUC_JID
),
'info'
:
'
\x19
%s}'
%
dump_tuple
(
get_theme
().
COLOR_INFORMATION_TEXT
),
'jid'
:
name
,
'bare_jid'
:
safeJID
(
name
).
bare
'jid'
:
tab
.
jid
.
full
,
'bare_jid'
:
tab
.
jid
.
bare
,
}
ctx
=
self
.
get_context
(
name
)
...
...
plugins/ping.py
View file @
7a1b2b98
...
...
@@ -22,6 +22,7 @@ Command
the current interlocutor.
"""
from
slixmpp
import
InvalidJID
from
poezio.decorators
import
command_args_parser
from
poezio.plugin
import
BasePlugin
from
poezio.roster
import
roster
...
...
@@ -116,7 +117,7 @@ class Plugin(BasePlugin):
def
command_private_ping
(
self
,
arg
):
if
arg
:
return
self
.
command_ping
(
arg
)
self
.
command_ping
(
self
.
api
.
current_tab
().
name
)
self
.
command_ping
(
self
.
api
.
current_tab
().
jid
)
@
command_args_parser
.
raw
def
command_muc_ping
(
self
,
arg
):
...
...
@@ -124,10 +125,13 @@ class Plugin(BasePlugin):
return
user
=
self
.
api
.
current_tab
().
get_user_by_name
(
arg
)
if
user
:
jid
=
s
afeJID
(
self
.
api
.
current_tab
().
name
)
jid
=
s
elf
.
api
.
current_tab
().
jid
jid
.
resource
=
user
.
nick
else
:
jid
=
safeJID
(
arg
)
try
:
jid
=
JID
(
arg
)
except
InvalidJID
:
return
self
.
api
.
information
(
'Invalid JID: %s'
%
arg
,
'Error'
)
self
.
command_ping
(
jid
.
full
)
@
command_args_parser
.
raw
...
...
plugins/reorder.py
View file @
7a1b2b98
...
...
@@ -112,7 +112,7 @@ def parse_runtime_tablist(tablist):
i
+=
1
result
=
check_tab
(
tab
)
if
result
:
props
.
append
((
i
,
'%s:%s'
%
(
result
,
tab
.
name
)))
props
.
append
((
i
,
'%s:%s'
%
(
result
,
tab
.
jid
.
full
)))
return
props
...
...
plugins/replace.py
View file @
7a1b2b98
...
...
@@ -102,11 +102,11 @@ def replace_random_user(message, tab):
if
isinstance
(
tab
,
tabs
.
MucTab
):
return
random
.
choice
(
tab
.
users
).
nick
elif
isinstance
(
tab
,
tabs
.
PrivateTab
):
return
random
.
choice
([
JID
(
tab
.
name
)
.
resource
,
tab
.
own_nick
])
return
random
.
choice
([
tab
.
jid
.
resource
,
tab
.
own_nick
])
else
:
# that doesn’t make any sense. By why use this pattern in a
# ConversationTab anyway?
return
str
(
tab
.
name
)
return
tab
.
jid
.
full
def
replace_dice
(
message
,
tab
):
...
...
plugins/server_part.py
View file @
7a1b2b98
...
...
@@ -39,7 +39,7 @@ class Plugin(BasePlugin):
if
not
args
and
not
isinstance
(
current_tab
,
MucTab
):
return
self
.
core
.
command_help
(
'server_part'
)
elif
not
args
:
jid
=
safeJID
(
current_tab
.
name
)
.
bare
jid
=
current_tab
.
jid
.
bare
message
=
None
elif
len
(
args
)
==
1
:
jid
=
safeJID
(
args
[
0
]).
domain
...
...
@@ -60,6 +60,6 @@ class Plugin(BasePlugin):
serv_list
=
set
()
for
tab
in
self
.
core
.
get_tabs
(
MucTab
):
if
tab
.
joined
:
serv
=
safeJID
(
tab
.
name
)
.
server
serv
=
tab
.
jid
.
server
serv_list
.
add
(
serv
)
return
Completion
(
the_input
.
new_completion
,
sorted
(
serv_list
),
1
,
' '
)
plugins/tell.py
View file @
7a1b2b98
...
...
@@ -75,7 +75,7 @@ class Plugin(BasePlugin):
if
not
self
.
tabs
.
get
(
tab
):
self
.
api
.
information
(
'No message queued.'
,
'Info'
)
return
build
=
[
'Messages queued for %s:'
%
tab
.
nam
e
]
build
=
[
'Messages queued for %s:'
%
tab
.
jid
.
bar
e
]
for
nick
,
messages
in
self
.
tabs
[
tab
].
items
():
build
.
append
(
' for %s:'
%
nick
)
for
message
in
messages
:
...
...
plugins/time_marker.py
View file @
7a1b2b98
...
...
@@ -36,7 +36,7 @@ from datetime import datetime, timedelta
class
Plugin
(
BasePlugin
):
def
init
(
self
):
self
.
api
.
add_event_handler
(
"muc_msg"
,
self
.
on_muc_msg
)
# Dict of MucTab.
nam
e: last_message date, so we don’t have to
# Dict of MucTab.
jid.bar
e: last_message date, so we don’t have to
# retrieve the messages of the given muc to look for the last
# message’s date each time. Also, now that I think about it, the
# date of the message is not event kept in the Message object, so…
...
...
@@ -66,8 +66,8 @@ class Plugin(BasePlugin):
res
+=
"%s seconds, "
%
seconds
return
res
[:
-
2
]
last_message_date
=
self
.
last_messages
.
get
(
tab
.
nam
e
)
self
.
last_messages
[
tab
.
nam
e
]
=
datetime
.
now
()
last_message_date
=
self
.
last_messages
.
get
(
tab
.
jid
.
bar
e
)
self
.
last_messages
[
tab
.
jid
.
bar
e
]
=
datetime
.
now
()
if
last_message_date
:
delta
=
datetime
.
now
()
-
last_message_date
if
delta
>=
timedelta
(
0
,
self
.
config
.
get
(
'delay'
,
900
)):
...
...
plugins/vcard.py
View file @
7a1b2b98
...
...
@@ -273,7 +273,7 @@ class Plugin(BasePlugin):
if
arg
:
self
.
command_vcard
(
arg
)
return
self
.
command_vcard
(
self
.
api
.
current_tab
().
name
)
self
.
command_vcard
(
self
.
api
.
current_tab
().
jid
.
full
)
@
command_args_parser
.
raw
def
command_muc_vcard
(
self
,
arg
):
...
...
@@ -282,10 +282,12 @@ class Plugin(BasePlugin):
return
user
=
self
.
api
.
current_tab
().
get_user_by_name
(
arg
)
if
user
:
# No need to use safeJID here, we already know the JID is valid.
jid
=
JID
(
self
.
api
.
current_tab
().
name
+
'/'
+
user
.
nick
)
jid
=
self
.
api
.
current_tab
().
jid
.
bare
+
'/'
+
user
.
nick
else
:
jid
=
safeJID
(
arg
)
try
:
jid
=
safeJID
(
arg
)
except
InvalidJID
:
return
self
.
api
.
information
(
'Invalid JID: %s'
%
arg
,
'Error'
)
self
.
_get_vcard
(
jid
)
@
command_args_parser
.
raw
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment