https://github.com/telegramdesktop/tdesktop/blob/d98bbca353fa12cc7b7fcecd193335db363aec35/Telegram/SourceFiles/core/click_handler_types.cpp#L32 #telegram
GitHub
telegramdesktop/tdesktop
Telegram Desktop messaging app. Contribute to telegramdesktop/tdesktop development by creating an account on GitHub.
duangsuse::Echo
https://github.com/telegramdesktop/tdesktop/blob/d98bbca353fa12cc7b7fcecd193335db363aec35/Telegram/SourceFiles/core/click_handler_types.cpp#L32 #telegram
(其实我一直以为 Telegram Desktop 源码结构维护得那么好的话,这种链接路由应该专门分一个文件实现的,但其实内联在链接点击里实现了?(其实只不过是在那个文件里实现,不是在点击事件函数里实现的
(说实话,我不是很了解他们是怎么找到这些黑科技一样的玩法的... 我都懒得玩这些呢... 🙈 (找 @lwl12 问问去
我们来分析一下相应的算法 #telegram #algorithm #frontend #qt #cplusplus #desktop #linux #tool
... 算了直接找我要用的吧,首先我们说说 Telegram links 基本的 impact
telegramdesktop/tdesktopd/Telegram/SourceFiles/core/click_handler_types.h@d98bbca353fa12cc7b7fcecd193335db363aec35
clickHandler 就是链接派发逻辑。它分类对 Post 里内联的链接进行派发(到实际动作,如打开用户信息窗口),Types 是里面处理的数据类型,如用户 ID、网址 URL 等
public:
TextClickHandler(bool fullDisplayed = true)
QString copyToClipboardText()
QString tooltip()
class UrlClickHandler
class HiddenUrlClickHandler
class BotGameUrlClickHandler
class MentionClickHandler
class MentionNameClickHandler
class HashtagClickHandler
class CashtagClickHandler
class BotCommandClickHandler
充分体现了面向对象编程的继承性和抽象性(迫真
然后我们看看实际上的实现们
... 总之,我觉得应该搞一个自动正则匹配 URL 然后拿指定逻辑替换的插件,这样以后我就不用手动弄优雅(隐式)链接了
$伪 hashtag
(说实话,我不是很了解他们是怎么找到这些黑科技一样的玩法的... 我都懒得玩这些呢... 🙈 (找 @lwl12 问问去
我们来分析一下相应的算法 #telegram #algorithm #frontend #qt #cplusplus #desktop #linux #tool
... 算了直接找我要用的吧,首先我们说说 Telegram links 基本的 impact
telegramdesktop/tdesktopd/Telegram/SourceFiles/core/click_handler_types.h@d98bbca353fa12cc7b7fcecd193335db363aec35
clickHandler 就是链接派发逻辑。它分类对 Post 里内联的链接进行派发(到实际动作,如打开用户信息窗口),Types 是里面处理的数据类型,如用户 ID、网址 URL 等
public:
TextClickHandler(bool fullDisplayed = true)
QString copyToClipboardText()
QString tooltip()
class UrlClickHandler
class HiddenUrlClickHandler
class BotGameUrlClickHandler
class MentionClickHandler
class MentionNameClickHandler
class HashtagClickHandler
class CashtagClickHandler
class BotCommandClickHandler
充分体现了面向对象编程的继承性和抽象性(迫真
然后我们看看实际上的实现们
QString tryConvertUrlToLocal(QString url)where
matchOptions = Regex::CaseInsensitive
bool telegramMeMatch = Regex::match(qsl("^https?://(www\\.)?(telegram\\.(me|dog)|t\\.me)/(.+)$"), url, matchOptions)
if telegramMeMatch {
query = telegramMeMatch->capturedRef(4);
query->ifMatch("^joinchat/([a-zA-Z0-9\\.\\_\\-]+)(\\?|$)", x => x->ifMatch("^/\\d+/?(?:\\?|$)", url("&post=")))
query->ifMatch("^addstickers/([a-zA-Z0-9\\.\\_]+)(\\?|$)")
query->ifMatch("^share/url/?\\?(.+)$")
query->ifMatch("^confirmphone/?\\?(.+)")
query->ifMatch("iv/?\\?(.+)(#|$)")
query->ifMatch("socks/?\\?(.+)(#|$)")
query->ifMatch("proxy/?\\?(.+)(#|$)")
query->ifMatch("^([a-zA-Z0-9\\.\\_]+)(/?\\?|/?$|/(\\d+)/?(?:\\?|$))")
}
... 有点累,不用伪代码了吧,实现细节都抖出来有点多了... 总之,我觉得应该搞一个自动正则匹配 URL 然后拿指定逻辑替换的插件,这样以后我就不用手动弄优雅(隐式)链接了
$伪 hashtag
GitHub
telegramdesktop/tdesktop
Telegram Desktop messaging app. Contribute to telegramdesktop/tdesktop development by creating an account on GitHub.
duangsuse::Echo
(其实我一直以为 Telegram Desktop 源码结构维护得那么好的话,这种链接路由应该专门分一个文件实现的,但其实内联在链接点击里实现了?(其实只不过是在那个文件里实现,不是在点击事件函数里实现的 (说实话,我不是很了解他们是怎么找到这些黑科技一样的玩法的... 我都懒得玩这些呢... 🙈 (找 @lwl12 问问去 我们来分析一下相应的算法 #telegram #algorithm #frontend #qt #cplusplus #desktop #linux #tool ... 算了直接找我要用的吧,首先我们说说…
好像不行吧... tg 还有个 cashtag 不知道有没有关系,再看看...
duangsuse::Echo
好像不行吧... tg 还有个 cashtag 不知道有没有关系,再看看...
知道原因了,这个是处理链接的,我还没找到解析消息到包含 # hashtag 的代码... 找到了就知道了
duangsuse::Echo
我就不信扫内存都找不到原链接在哪里,我根本不用找 GDB、Qt GDB 加载符号调试程序
扫不了内存... Telegram
所以只能退而求其次
mmap() 映射了太多内存到 va space 虚拟地址空间, EDB 上去直接崩溃要不然会让计算机 HID (人机接口)完全处于无法使用的状态...所以只能退而求其次
duangsuse::Echo
问题解决。这个 $ dollar(准确的说大概是「cash」吧),是个 cashtag... 因为我在 Cashtag 的 onClick 实现上打断点它停下了...
This media is not supported in your browser
VIEW IN TELEGRAM
duangsuse::Echo
$RICH
... 居然要大写么... 居然是我多想了,气死
duangsuse::Echo
... 居然要大写么... 居然是我多想了,气死
This media is not supported in your browser
VIEW IN TELEGRAM