Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3769905
D1322.id3395.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D1322.id3395.diff
View Options
diff --git a/Core.tcl b/Core.tcl
--- a/Core.tcl
+++ b/Core.tcl
@@ -711,6 +711,59 @@
}
}
+###
+### Handle / nick handling
+###
+
+proc resolve_nick {nickname} {
+ set resolved [whois $nickname 0]
+
+ if {$resolved == ""} {
+ return $nickname
+ }
+
+ return $resolved
+}
+
+# Returns an identified nickname or "" if not identified
+# By default, can also return strings like "kumkum!kumkum@eglide.org"
+proc whois {nickname {useUserHost 1}} {
+ # By handle
+ set result [nick2hand $nickname]
+ if {$result != "*"} {
+ #Will return "", when nick doesn't exist to avoid further processing.
+ return $result
+ }
+
+ #Gets user@host
+ set uhost [getchanhost $nickname]
+ set host [lindex [split $uhost @] 1]
+
+ # By Cloak
+ if {[regexp / $host]} {
+ set cloak [split $host /]
+ set group [lindex $cloak 0]
+
+ if {$group != "gateway" && $group != "nat"} {
+ # @freenode/staff/ubuntu.member.niko → niko
+ # @wikipedia/pdpc.21for7.elfix → elfix
+ # @wikipedia/poulpy → poulpy
+ return [lindex [split [lindex $cloak end] .] end]
+ }
+ }
+
+ # By NickServ
+ # TODO: code with callback
+
+ # By user@host, when the host doesn't contain any digit
+ if {$useUserHost && [regexp {^[^0-9]*$} $host]} {
+ return "$nickname!$uhost"
+ }
+
+ # Can't identify
+ return ""
+}
+
#
# IP and host string manipulations
#
diff --git a/Daeghrefn/Communication.tcl b/Daeghrefn/Communication.tcl
--- a/Daeghrefn/Communication.tcl
+++ b/Daeghrefn/Communication.tcl
@@ -285,43 +285,6 @@
putquick "NOTICE $nick :!identica is currently disabled. Is identi.ca still usable since pump.io migration? If so, please request the command."
}
-proc whois {nickname} {
- # By handle
- set result [nick2hand $nickname]
- if {$result != "*"} {
- #Will return "", when nick doesn't exist to avoid further processing.
- return $result
- }
-
- #Gets user@host
- set uhost [getchanhost $nickname]
- set host [lindex [split $uhost @] 1]
-
- # By Cloak
- if {[regexp / $host]} {
- set cloak [split $host /]
- set group [lindex $cloak 0]
-
- if {$group != "gateway" && $group != "nat"} {
- # @freenode/staff/ubuntu.member.niko → niko
- # @wikipedia/pdpc.21for7.elfix → elfix
- # @wikipedia/poulpy → poulpy
- return [lindex [split [lindex $cloak end] .] end]
- }
- }
-
- # By NickServ
- # TODO: code with callback
-
- # By user@host, when the host doesn't contain any digit
- if {[regexp {^[^0-9]*$} $host]} {
- return "$nickname!$uhost"
- }
-
- # Can't identify
- return ""
-}
-
#!pub or !twit or !tweet
#The account is channel dependant
proc pub:twitter {nick uhost handle chan text} {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 17:56 (21 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260441
Default Alt Text
D1322.id3395.diff (2 KB)
Attached To
Mode
D1322: Implement resolve_nick and whois commands
Attached
Detach File
Event Timeline
Log In to Comment