aboutsummaryrefslogtreecommitdiff
path: root/accountscript.tcl
blob: 6d97372e787906d5c0a3cffd966cb5479fec9433 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
bind PUB * ,op acct_op

proc acct_op {nick user hand chan text} {
    set accthand [finduser -account [getaccount $nick]]
    if [string match $accthand "*"] {
      putserv "PRIVMSG $chan :$nick, you are not authenticated to NickServ and/or I don't know you!"
      return 1
    }
    if {[matchattr $accthand +o|+o $chan]} {
      pushmode $chan +o $text
      putserv "PRIVMSG $chan :ok"
    } else {
      putserv "PRIVMSG $chan :$nick, you do not have access to ,op"
    }
}


bind PUB * ,masskick acct_masskick

proc acct_masskick {nick user hand chan text} {
    set accthand [finduser -account [getaccount $nick]]
    if [string match $accthand "*"] {
      putserv "PRIVMSG $chan :$nick, you are not authenticated to NickServ and/or I don't know you!"
      return 1
    }
    if {[matchattr $accthand +o $chan]} {
      if {$text == ""} {
          putserv "PRIVMSG $chan :\[masskick\] usage: ,masskick <nick>"
          return 1
      }
      putserv "PRIVMSG $chan :\[masskick\] starting..."
      foreach chann [channels] {
          if {([botisop $chann]) && ([onchan $text $chann])} {
              putkick $chann $text "Your behaviour is not conducive to the desired environment."
              puthelp "PRIVMSG $chan :\[masskick\] kicked $text from $chann"
          }
      }
      puthelp "PRIVMSG $chan :\[masskick\] done"
    } else {
      putserv "PRIVMSG $chan :$nick, you do not have access to ,masskick"
    }
}

bind PUB * ,whoami acct_whoami

proc acct_whoami {nick user hand chan text} {
    set acct [getaccount $nick]
    set accthand [finduser -account $acct]
    if [string match $acct ""] {
      putserv "PRIVMSG $chan :idk"
      return 1
    }
    putserv "PRIVMSG $chan :$nick: you're authenticated to NickServ as $acct"
    if [string match $accthand ""] {
        putserv "PRIVMSG $chan :$nick: '$acct' isn't a known user to me, though."
    } else {
        putserv "PRIVMSG $chan :$nick: hi! '$acct' is also a known user to me! (flags: [chattr $accthand * $chan])"
    }
}

bind PUB * ,whois acct_whois

proc acct_whois {nick user hand chan text} {
    set search [string trim $text]
    if {$search == ""} {
        putserv "PRIVMSG $chan :gimmie someone to whois lol"
	return 1
    }
    if {[isbotnick $search]} {
        putserv "PRIVMSG $chan :hi! i'm eggdrop :3 (fireonlive thinks he owns me, but I actually own him)"
	return 1
    }
    set acct [getaccount $search]
    set accthand [finduser -account $acct]
    if [string match $acct "*"] {
      putserv "PRIVMSG $chan :idk"
      return 1
    }
    putserv "PRIVMSG $chan :$search is authenticated to NickServ as $acct"
    if [string match $accthand ""] {
        putserv "PRIVMSG $chan :$acct isn't a known user to me, though."
    } else {
        putserv "PRIVMSG $chan :$acct is also a known user to me! (flags: [chattr $accthand * $chan])"
    }
}

bind PUB * ,join acct_join

proc acct_join {nick user hand chan text} {
    set accthand [finduser -account [getaccount $nick]]
    if [string match $accthand "*"] {
      putserv "PRIVMSG $chan :$nick, you are not authenticated to NickServ and/or I don't know you!"
      return 1
    }
    if {[matchattr $accthand +f]} {
      channel add [string trim $text]
      channel set [string trim $text] +lkarma +transferinliner +seen +8ball
      putquick "PRIVMSG $chan :\[join\] joined [string trim $text] - set flags +lkarma +transferinliner +seen +8ball"
      savechannels
    } else {
      putserv "PRIVMSG $chan :$nick, you do not have access to ,join"
    }
}

bind MSG * join acct_join_pm

proc acct_join_pm {nick user hand text} {
    set accthand [finduser -account [getaccount $nick]]
    if [string match $accthand "*"] {
      putserv "NOTICE $nick :you are not authenticated to NickServ and/or I don't know you!"
      return 1
    }
    if {[matchattr $accthand +f]} {
      channel add [string trim $text]
      channel set [string trim $text] +lkarma +transferinliner +seen +8ball +nitter
      putquick "NOTICE $nick :\[join\] joined [string trim $text] - set flags +lkarma +transferinliner +seen +8ball +nitter"
      putquick "PRIVMSG #fire-trail :\[join\] $nick ($accthand) requested join [string trim $text]. joined and set flags +lkarma +transferinliner +seen +8ball +nitter"
      savechannels
    } else {
      putserv "NOTICE $nick :you do not have access to join"
    }
}
bind PUB * ,chflags acct_chflags
bind PUB * ,chanset acct_chflags

proc acct_chflags {nick user hand chan text} {
    set accthand [finduser -account [getaccount $nick]]
    if [string match $accthand "*"] {
      putserv "PRIVMSG $chan :$nick, you are not authenticated to NickServ and/or I don't know you!"
      return 1
    }
    if {[matchattr $accthand +o]} {
        set target [lindex [split $text] 0]
        set flags [join [lrange [split $text] 1 end] " "]
        channel set $target $flags
        putquick "PRIVMSG $chan :\[chanset\] set flags \"$flags\" for $target"
        savechannels
    } else {
      putserv "PRIVMSG $chan :$nick, you do not have access to ,chflags"
    }
}

bind PUB * ,part acct_part

proc acct_part {nick user hand chan text} {
    set accthand [finduser -account [getaccount $nick]]
    if [string match $accthand "*"] {
      putserv "PRIVMSG $chan :$nick, you are not authenticated to NickServ and/or I don't know you!"
      return 1
    }
    if {[matchattr $accthand +f]} {
      channel remove [string trim $text]
      putquick "PRIVMSG $chan :\[part\] removed [string trim $text]"
      savechannels
    } else {
      putserv "PRIVMSG $chan :$nick, you do not have access to ,part"
    }
}

bind MSG * part acct_part_pm

proc acct_part_pm {nick user hand text} {
    set accthand [finduser -account [getaccount $nick]]
    if [string match $accthand "*"] {
      putserv "NOTICE $nick :you are not authenticated to NickServ and/or I don't know you!"
      return 1
    }
    if {[matchattr $accthand +f]} {
      channel remove [string trim $text]
      putquick "NOTICE $nick :\[part\] removed [string trim $text]"
      putquick "PRIVMSG #fire-trail :\[part\] $nick ($accthand) removed [string trim $text]"
      savechannels
    } else {
      putserv "NOTICE $nick :you do not have access to part"
    }
}