Add message URLs, unify URL generation
This commit is contained in:
parent
36df984b09
commit
0d9f7f35f0
4 changed files with 31 additions and 24 deletions
21
state.js
21
state.js
|
@ -26,3 +26,24 @@ export const Unread = {
|
|||
return (priority[a] > priority[b]) ? a : b;
|
||||
},
|
||||
};
|
||||
|
||||
export function getNickURL(nick) {
|
||||
return "irc:///" + encodeURIComponent(nick) + ",isnick";
|
||||
}
|
||||
|
||||
export function getBufferURL(buf) {
|
||||
switch (buf.type) {
|
||||
case BufferType.SERVER:
|
||||
return "irc:///";
|
||||
case BufferType.CHANNEL:
|
||||
return "irc:///" + encodeURIComponent(buf.name);
|
||||
case BufferType.NICK:
|
||||
return getNickURL(buf.name);
|
||||
}
|
||||
throw new Error("Unknown buffer type: " + buf.type);
|
||||
}
|
||||
|
||||
export function getMessageURL(buf, msg) {
|
||||
var bufURL = getBufferURL(buf);
|
||||
return bufURL + "#timestamp=" + encodeURIComponent(msg.tags.time);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue