[ekg2-devel] Skrypty przykładowe (perl)

Wiesław Ochmiński wiechu w wiechu.com
Pon, 18 Lut 2008, 16:30:21 CET


Kłaniam!

Niewiele rzeczy irytuje bardziej niż niedziałające (lub działające źle)
programy przykładowe.

    Pozdrawiam,
	W.
-- 
 Wiesław Ochmiński, Polska Północna, Malbork.
-------------- następna część ---------
Index: contrib/perl/sample.pl
===================================================================
--- contrib/perl/sample.pl	(wersja 3796)
+++ contrib/perl/sample.pl	(kopia robocza)
@@ -10,7 +10,7 @@
 #		sesja['default'] = "1"
 	}
 	else {
-		ekg.echo("sesja ".$session . " nie jest połączona");
+		Ekg2::echo("sesja ".$session . " nie jest połączona");
 	}
 	Ekg2::echo("Dostałem status!");
 	Ekg2::echo("Sesja : ".$session);
@@ -41,16 +41,14 @@
 }
 
 sub handle_message {
-	my ($session, $uid, $type, $text, $sent_time, $ign_level) = @_;
+	my ($session, $uid, $text, $sent_time, $ign_level) = @_;
 	
 	Ekg2::debug("[test script] some debug\n");
 	Ekg2::echo("Dostałem wiadomość!");
 	Ekg2::echo("Sesja : " . $session);
 	Ekg2::echo("UID   : " . $uid);
-        if ($class == MSGCLASS_MESSAGE) { Ekg2::echo("Typ   : msg"); }
-	else { if ($class == MSGCLASS_CHAT ) { Ekg2::echo("Typ   : chat"); } }
 #     Ekg2::echo("Czas  : "+time.strftime("%a, %d %b %Y %H:%M:%S %Z", time.gmtime(sent_time)))
-     Ekg2::echo("Ign   : " . $ignore_level);
+     Ekg2::echo("Ign   : " . $ign_level);
      Ekg2::echo("TxtLen: " . length($text));
      if (length($text) == 13) {
   	Ekg2::echo("Oj, ale pechowa liczba, nie odbieram");
@@ -71,20 +69,14 @@
 }
 
 sub ekg2_message {
-	my ($session, $uid, $rcpt, $text, $format, $send, $class) = @_;
+	my ($session, $uid, $rcpt, $text, $format, $send) = @_;
 	
-	$tclass = $$class;
-	
-#	$$text   = "dupa4";
-#	Ekg2::echo($$text);
-#	$$class -= EKG_NO_THEMEBIT;
 
-	if ($tclass & EKG_NO_THEMEBIT) { $tclass -= EKG_NO_THEMEBIT; };
 
 # jesli moje to handle_msg_own();
-	if ($tclass == EKG_MSGCLASS_SENT || $tclass == EKG_MSGCLASS_SENT_CHAT) { return handle_message_own($$session, $$rcpt, $$text); }
+	if ($$rcpt) { return handle_message_own($$session, $$rcpt, $$text); }
 # jesli nie to  handle_msg();
-	else                                                                   { return handle_message($$session, $$uid, $$tclass, $$text, $$send, 0); }
+	else        { return handle_message($$session, $$uid, $$text, $$send, 0); }
 }
 
 sub ekg2_handle_connect { 
Index: contrib/perl/ggbe.pl
===================================================================
--- contrib/perl/ggbe.pl	(wersja 3796)
+++ contrib/perl/ggbe.pl	(kopia robocza)
@@ -21,7 +21,7 @@
 my %persony;
 
 sub ekg2_message {
-  my ($tsession, $tuid, $trcpt, $ttext, $tformat, $tsend, $tclass) = @_;
+  my ($tsession, $tuid, $trcpt, $ttext, $tformat, $tsend) = @_;
 
   $session = $$tsession;
   $uid = $$tuid;


Więcej informacji o liście dyskusyjnej ekg2-devel