Permalink
Browse files

3.7: added no_type option

  • Loading branch information...
1 parent 22cac8d commit c5226aa5c67b6f38dfcf4bfde4fcc73e3d8970a3 @cooper committed Apr 14, 2012
Showing with 10 additions and 3 deletions.
  1. +5 −1 New/Omegle.pm
  2. +5 −2 README.md
View
@@ -26,7 +26,7 @@ use Furl;
use JSON;
our ($VERSION, $online, $ua, @servers,
- $updated, $lastserver, %response) = (3.6, 0, Furl->new);
+ $updated, $lastserver, %response) = (3.7, 0, Furl->new);
# New::Omegle->new(%opts)
# creates a new New::Omegle session instance.
@@ -223,12 +223,14 @@ sub handle_event {
# stranger is typing
when ('typing') {
+ continue if $om->{no_type};
$om->fire('type') unless $om->{typing};
$om->{typing} = 1;
}
# stranger stopped typing
when ('stoppedTyping') {
+ continue if $om->{no_type};
$om->fire('stoptype') if $om->{typing};
delete $om->{typing};
}
@@ -253,6 +255,7 @@ sub handle_event {
# spyee is typing
when ('spyTyping') {
+ continue if $om->{no_type};
my $which = $event[1];
$which =~ s/Stranger //;
$om->fire('spytype', $which) unless $om->{"typing_$which"};
@@ -261,6 +264,7 @@ sub handle_event {
# spyee stopped typing
when ('spyStoppedTyping') {
+ continue if $om->{no_type};
my $which = $event[1];
$which =~ s/Stranger //;
$om->fire('spystoptype', $which);
View
@@ -49,6 +49,7 @@ be changed dynamically by changing the associated values.
- __question__: a question for two strangers to discuss (if use_question enabled)
- __server__: specify a server (by default it alternates through all servers)
- __static__: if true, do not cycle through server list
+- __no_type__: true if you think typing events are annoying and useless
```perl
my $om = New::Omegle->new(
@@ -70,7 +71,8 @@ my $om = New::Omegle->new(
server => 'bajor.omegle.com', # don't use this option without reason
topics => ['IRC', 'Omegle', 'ponies'],
use_likes => 1,
- use_question => 1
+ use_question => 1,
+ no_type => 1
);
```
@@ -85,7 +87,8 @@ my $id = $om->start();
### $om->go()
Perhaps the most important method - checks for new events, handles pending events, etc. You probably want to put this in the "main loop" of your program.
-Returns true (`1`) if the session is established or `undef` if there is no session connected.
+Returns true (`1`) if the session is established or `undef` if there is no session connected. No matter how many times this is called, New::Omegle will
+only make HTTP requests in one-second intervals, so you don't have to worry about the frequency of your loop.
```perl
while (1) {

0 comments on commit c5226aa

Please sign in to comment.