[1133] in BarnOwl Developers
[D-O-H] r1087 - in branches/barnowl_perlaim/owl: . perl/modules/AIM/lib/BarnOwl/Module
daemon@ATHENA.MIT.EDU (geofft@MIT.EDU)
Thu Oct 29 18:13:22 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
X-Original-To: nelhage@nelhage.com
Date: Mon, 7 Jul 2008 06:23:19 -0400 (EDT)
To: dirty-owl-hackers@mit.edu
From: geofft@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Author: geofft
Date: 2008-07-07 06:23:18 -0400 (Mon, 07 Jul 2008)
New Revision: 1087
Modified:
branches/barnowl_perlaim/owl/commands.c
branches/barnowl_perlaim/owl/editwin.c
branches/barnowl_perlaim/owl/functions.c
branches/barnowl_perlaim/owl/owl.h
branches/barnowl_perlaim/owl/perl/modules/AIM/lib/BarnOwl/Module/AIM.pm
branches/barnowl_perlaim/owl/perlconfig.c
Log:
This would probably work, except it doesn't compile.
Modified: branches/barnowl_perlaim/owl/commands.c
===================================================================
--- branches/barnowl_perlaim/owl/commands.c 2008-07-05 03:30:19 UTC (rev 1086)
+++ branches/barnowl_perlaim/owl/commands.c 2008-07-07 10:23:18 UTC (rev 1087)
@@ -2469,12 +2469,17 @@
void owl_command_editresponse_done(owl_editwin *e)
{
+ char *text = owl_strdup(owl_editwin_get_text(e));
+ void (*callback)(void *, char *) = owl_editwin_get_callback(e);
+ void *cbdata = owl_editwin_get_cbdata(e);
+
owl_global_set_typwin_inactive(&g);
owl_editwin_fullclear(e);
wnoutrefresh(owl_editwin_get_curswin(e));
owl_global_set_needrefresh(&g);
- owl_function_run_buffercommand();
+ callback(cbdata, text);
+ owl_free(text);
}
@@ -2485,7 +2490,7 @@
owl_history_store(hist, owl_editwin_get_text(e));
owl_history_reset(hist);
- owl_function_run_buffercommand();
+ owl_editwin_do_callback(e);
owl_editwin_new_style(e, OWL_EDITWIN_STYLE_ONELINE, NULL);
owl_editwin_fullclear(e);
owl_global_set_typwin_inactive(&g);
Modified: branches/barnowl_perlaim/owl/editwin.c
===================================================================
--- branches/barnowl_perlaim/owl/editwin.c 2008-07-05 03:30:19 UTC (rev 1086)
+++ branches/barnowl_perlaim/owl/editwin.c 2008-07-07 10:23:18 UTC (rev 1087)
@@ -93,11 +93,11 @@
return "";
}
-void owl_editwin_set_callback(owl_editwin *e, void (*cb)(owl_editwin*)) {
+void owl_editwin_set_callback(owl_editwin *e, void (*cb)(void*, char*)) {
e->callback = cb;
}
-void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin*) {
+void (*owl_editwin_get_callback(owl_editwin*))(void *cbdata, char *text) {
return e->callback;
}
@@ -110,13 +110,14 @@
}
void owl_editwin_do_callback(owl_editwin *e) {
- void (*cb)(owl_editwin*);
+ /* XXX get rid of me */
+ void (*cb)(void*, char*);
cb=owl_editwin_get_callback(e);
if(!cb) {
owl_function_error("Internal error: No editwin callback!");
} else {
/* owl_function_error("text: |%s|", owl_editwin_get_text(e)); */
- cb(e);
+ cb(e->cbdata, e->text);
}
}
Modified: branches/barnowl_perlaim/owl/functions.c
===================================================================
--- branches/barnowl_perlaim/owl/functions.c 2008-07-05 03:30:19 UTC (rev 1086)
+++ branches/barnowl_perlaim/owl/functions.c 2008-07-07 10:23:18 UTC (rev 1087)
@@ -1130,11 +1130,6 @@
owl_global_set_resize_pending(&g);
}
-void owl_function_run_buffercommand()
-{
- owl_editwin_do_callback(owl_global_get_typwin(&g));
-}
-
void owl_function_debugmsg(char *fmt, ...)
{
FILE *file;
Modified: branches/barnowl_perlaim/owl/owl.h
===================================================================
--- branches/barnowl_perlaim/owl/owl.h 2008-07-05 03:30:19 UTC (rev 1086)
+++ branches/barnowl_perlaim/owl/owl.h 2008-07-07 10:23:18 UTC (rev 1087)
@@ -452,7 +452,7 @@
int echochar;
char *command;
- void (*callback)(struct _owl_editwin*);
+ void (*callback)(void *, char *);
void *cbdata;
} owl_editwin;
Modified: branches/barnowl_perlaim/owl/perl/modules/AIM/lib/BarnOwl/Module/AIM.pm
===================================================================
--- branches/barnowl_perlaim/owl/perl/modules/AIM/lib/BarnOwl/Module/AIM.pm 2008-07-05 03:30:19 UTC (rev 1086)
+++ branches/barnowl_perlaim/owl/perl/modules/AIM/lib/BarnOwl/Module/AIM.pm 2008-07-07 10:23:18 UTC (rev 1087)
@@ -36,7 +36,6 @@
}
sub cmd_aimlogin {
-=comment
my ($cmd, $user, $pass) = @_;
if (!defined $user) {
BarnOwl::start_question('Username: ', sub {
@@ -47,10 +46,7 @@
cmd_aimlogin($cmd, $user, @_);
});
} else {
-=cut
- {
my $oscar = Net::OSCAR->new();
- my ($user, $pass) = ('...', '...');
$oscar->set_callback_im_in(\&on_im_in);
$oscar->set_callback_signon_done(sub ($) {
BarnOwl::admin_message('AIM',
Modified: branches/barnowl_perlaim/owl/perlconfig.c
===================================================================
--- branches/barnowl_perlaim/owl/perlconfig.c 2008-07-05 03:30:19 UTC (rev 1086)
+++ branches/barnowl_perlaim/owl/perlconfig.c 2008-07-07 10:23:18 UTC (rev 1087)
@@ -471,17 +471,18 @@
SvREFCNT_dec(d->pfunc);
}
-void owl_perlconfig_edit_callback(owl_editwin *e)
+void owl_perlconfig_edit_callback(void *cbdata, char *c_text);
{
- SV *cb = (SV*)(e->cbdata);
+ SV *cb = (SV*)cbdata;
SV *text;
unsigned int n_a;
dSP;
+ e->cbdata = NULL;
if(cb == NULL) {
owl_function_error("Perl callback is NULL!");
}
- text = newSVpv(owl_editwin_get_text(e), 0);
+ text = newSVpv(c_text, 0);
SvUTF8_on(text);
ENTER;
@@ -501,7 +502,6 @@
LEAVE;
SvREFCNT_dec(cb);
- e->cbdata = NULL;
}
void owl_perlconfig_mainloop()