Skip to content

Irclib amelioration #14

Closed
wants to merge 2 commits into from
View
5 libirc/ircBot.ml
@@ -33,15 +33,16 @@ let insert_bot (irc: IBC.irc) sched server port =
* @param server The server to which the bot will connect.
* @param port The port on which to connect.
*)
-let create_bot username realname nickname password server channel port callback =
+let create_bot username realname nickname password server channel port callback onreceive =
let parameters = {
IBC.username = username;
realname = realname;
nickname = nickname;
password = password;
server = server;
channel = channel;
- callback = callback
+ callback = callback;
+ onreceive = onreceive
} in
let sched = Scheduler.default in
insert_bot parameters sched server port
View
7 libirc/ircBotCore.proto
@@ -30,7 +30,8 @@
password:string;
server:string;
channel:string;
- callback: Scheduler.connection_info -> unit
+ callback: Scheduler.connection_info -> unit;
+ onreceive: Scheduler.connection_info -> string -> string -> string -> unit
}
-type payload = unit
@@ -51,6 +52,7 @@
read_welcome_messages(irc):
receive
| Sns (_, "376", _) -> join_channels(irc)
+ | Sns (_, "422", _) -> join_channels(irc)
| _ -> read_welcome_messages(irc)
join_channels(irc):
@@ -70,6 +72,9 @@ read_channels(irc):
% the outer application has no (clean) means of knowing
% whether the connection is still alive.
quit()
+ | SrvPrivmsg (header, dest, msg) ->
+ {{ Scheduler.push sched (fun () -> (irc.onreceive conn header dest msg)) }}
+ read_channels(irc)
| Ping msg ->
send (Pong msg);
read_channels(irc)
View
7 opabsl/jsbsl/bslCanvas.js
@@ -386,6 +386,13 @@ function bslcanvas_create_pattern(context, image, repeat)
context.arcTo( x1, y1, x2, y2, radius)
}
+##register arc: Canvas.context, int, int, int, float, float, bool -> void
+##args(context, centerX, centerY, radius, startingAngle, endingAngle, counterclockwise)
+{
+ context.arc(centerX, centerY, radius, startingAngle,
+ endingAngle, counterclockwise);
+}
+
##register rect: Canvas.context, int, int, int, int -> void
##args(context, x, y, w, h)
{
View
3 opabsl/mlbsl/bslIrc.ml
@@ -24,6 +24,7 @@ let write_msg conn msg = write_raw conn (IrcBotCore.string_of_msg msg)
##extern-type Irc.msg = IrcBotCore.msg
##register create_bot: string, string, string, string, string, string, int,\
- (Irc.connection -> void) -> void
+ (Irc.connection -> void),\
+ (Irc.connection, string, string, string -> void) -> void
##register write_raw: Irc.connection, string -> void
##register write_msg: Irc.connection, Irc.msg -> void
View
13 stdlib/core/xhtml/canvas.opa
@@ -394,7 +394,18 @@ Canvas = {{
arc_to(context : Canvas.context, x1 : int, y1 : int, x2 : int, y2 : int, r : int) : void =
%% BslCanvas.arc_to %%(context,x1,y1,x2,y2,r)
- //todo arc
+ /**
+ * arc
+ * @param context : Canvas.context
+ * @param centerX : int
+ * @param centerY : int
+ * @param radius : int
+ * @param startingAngle : float
+ * @param endinAngle : float
+ * @param counterclockwise : bool
+ */
+ arc(context : Canvas.context, centerX : int, centerY : int, radius : int, startingAngle : float, endingAngle : float, counterclockwise : bool) : void =
+ %% BslCanvas.arc %%(context, centerX, centerY, radius, startingAngle, endingAngle, counterclockwise)
rect(context : Canvas.context, x : int, y : int, w : int, h : int) : void =
%% BslCanvas.rect %%(context,x,y,w,h)
Something went wrong with that request. Please try again.