Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Irclib amelioration #14

Closed
wants to merge 2 commits into from

2 participants

@mattgu74

I have fixed the problem when irc server doesn't have a welcome message.

And I have also add a callback function for handling message.

@mattgu74

An other commit just add, this is a bypass for canvas (arc method) which was missing....

@frsinot

Thanks for this contribs; they are now merged locally and will soon percolate to github.

@frsinot frsinot closed this
@git-mlstate git-mlstate referenced this pull request from a commit
François-Régis Sinot [contrib] merge: pull request #14 from git://github.com/mattgu74/opalang e5e1a0f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 1, 2011
  1. @mattgu74
Commits on Oct 2, 2011
  1. @mattgu74

    [feature] Canvas.arc bypass

    mattgu74 authored
This page is out of date. Refresh to see the latest.
View
5 libirc/ircBot.ml
@@ -33,7 +33,7 @@ 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;
@@ -41,7 +41,8 @@ let create_bot username realname nickname password server channel port callback
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.