Changeset 59

Show
Ignore:
Timestamp:
03/02/08 19:37:40 (10 months ago)
Author:
scott
Message:

Fixed karma and small warning in mysql.awk

  • Turns out that \' is treated as ', so the escape was removed
  • Awkbot no longer lets you change your own karma, rather it ignores you when you try to remove your own karma point…and decrements your karma when you try to add karma for yourself.
Location:
trunk/awkbot/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/awkbot/src/awkbot.awk

    r56 r59  
    169169    } 
    170170 
    171     if (match(arg[1], /^(.*)\+\+$/, t)) awkbot_db_karma_inc(t[1]) 
    172     if (match(arg[1], /^(.*)--$/, t)) awkbot_db_karma_dec(t[1]) 
     171    if (match(arg[1], /^(.*)\+\+$/, t)) { 
     172        if (t[1] == nick) { 
     173            irc_privmsg(target, address "changing your own karma is bad karma") 
     174            awkbot_db_karma_dec(nick) 
     175        } 
     176        else { 
     177            awkbot_db_karma_inc(t[1]) 
     178        } 
     179    } 
     180    if (match(arg[1], /^(.*)--$/, t)) { 
     181        if (t[1] == nick) { 
     182            irc_privmsg(target, address "don't be dumb") 
     183        } 
     184        else { 
     185            awkbot_db_karma_dec(t[1]) 
     186        } 
     187    } 
    173188 
    174189    if (arg[1] == "awkdoc") { 
  • trunk/awkbot/src/mysql.awk

    r58 r59  
    4646 
    4747    print query | call 
    48     print query >> "/tmp/debug.log" 
    4948 
    5049    close(call) 
     
    113112function mysql_quote (string,   result) { 
    114113    gsub(/\\/, "\\\\", string) 
    115     gsub(/'/, "\\\'", string) 
     114    gsub(/'/, "\\'", string) 
    116115 
    117116    return "'" string "'"