Changeset e0ffe77 for perl/modules


Ignore:
Timestamp:
Jan 16, 2008, 8:18:25 PM (16 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
367fbf3
Parents:
b7b2a76
Message:
editwin.c: make locktext deal with UTF-8

Jabber - 
More utf-8 sanitizing.
New helper function to validate strings from C and set the utf8 flag if needed.
Location:
perl/modules/Jabber/lib/BarnOwl/Module
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm

    r05f0061 re0ffe77  
    2525use Net::DNS;
    2626use Getopt::Long;
     27
     28use utf8;
    2729
    2830our $VERSION = 0.1;
     
    294296    my $cmd = shift;
    295297    my $jid = new Net::Jabber::JID;
    296     $jid->SetJID(shift);
     298    $jid->SetJID(check_utf8(shift));
    297299    my $password = '';
    298     $password = shift if @_;
     300    $password = check_utf8(shift) if @_;
    299301
    300302    my $uid           = $jid->GetUserID();
     
    373375                    $vars{jlogin_havepass} = 1;
    374376                    $conn->removeConnection($jidStr);
    375                     BarnOwl::start_password( "Password for $jidStr: ", \&do_login );
     377                    BarnOwl::start_password("Password for $jidStr: ", \&do_login );
    376378                    return "";
    377379                }
     
    477479    }
    478480    else {
    479         $to = shift @ARGV;
     481      $to = check_utf8(shift @ARGV);
    480482    }
    481483
     
    521523    $cmd .= " -t $jwrite_thread" if $jwrite_thread;
    522524    $cmd .= " -s $jwrite_subject" if $jwrite_subject;
    523     BarnOwl::start_edit_win( $cmd, \&process_owl_jwrite );
     525    queue_admin_msg("$cmd - utf8: ".Encode::is_utf8($cmd));
     526
     527    BarnOwl::start_edit_win( Encode::encode_utf8($cmd), \&process_owl_jwrite );
    524528}
    525529
     
    10791083### Helper functions
    10801084
     1085sub check_utf8
     1086{
     1087  my $str = shift;
     1088  Encode::_utf8_on($str);
     1089  Encode::_utf8_off($str) unless (Encode::is_utf8($str, 1));
     1090  return $str;
     1091}
     1092
    10811093sub j2hash {
    10821094    my $j   = shift;
     
    12131225
    12141226sub resolveConnectedJID {
    1215     my $givenJIDStr = shift;
     1227    my $givenJIDStr = check_utf8(shift);
    12161228    my $givenJID    = new Net::Jabber::JID;
    12171229    $givenJID->SetJID($givenJIDStr);
  • perl/modules/Jabber/lib/BarnOwl/Module/Jabber/Connection.pm

    r892568b re0ffe77  
    11use warnings;
    22use strict;
     3use utf8;
    34
    45=head1 NAME
Note: See TracChangeset for help on using the changeset viewer.