]> jfr.im git - irc/quakenet/newserv.git/blobdiff - lua/lualocal.c
LUA: port luadb to dbapi2 to drop postgres dependency
[irc/quakenet/newserv.git] / lua / lualocal.c
index 2d519e55e340754eb000f26b4648f69eb01b49da..86993baeee7267e6c76ded7213a0030c0465ae73 100644 (file)
@@ -315,6 +315,32 @@ static int lua_localchanmsg(lua_State *ps) {
   LUA_RETURN(ps, LUA_OK);
 }
 
+static int lua_localchanopnotice(lua_State *ps) {
+  char *msg;
+  nick *source;
+  channel *target;
+
+  if(!lua_islong(ps, 1) || !lua_isstring(ps, 2) || !lua_isstring(ps, 3))
+    LUA_RETURN(ps, LUA_FAIL);
+
+  source = getnickbynumeric(lua_tolong(ps, 1));
+  if(!source)
+    LUA_RETURN(ps, LUA_FAIL);
+
+  target = findchannel((char *)lua_tostring(ps, 2));
+  if(!target)
+    LUA_RETURN(ps, LUA_FAIL);
+
+  msg = (char *)lua_tostring(ps, 3);
+
+  if(!lua_lineok(msg))
+    LUA_RETURN(ps, LUA_FAIL);
+
+  sendopnoticetochannel(source, target, "%s", msg);
+
+  LUA_RETURN(ps, LUA_OK);
+}
+
 static int lua_localnotice(lua_State *ps) {
   char *msg;
   nick *source;
@@ -668,5 +694,6 @@ void lua_registerlocalcommands(lua_State *l) {
   lua_register(l, "irc_localwallops", lua_localwallops);
 
   lua_register(l, "irc_localsimplechanmode", lua_localsimplechanmode);
+  lua_register(l, "irc_localchanopnotice", lua_localchanopnotice);
 }