Tadashi Okoshi
slash****@users*****
2005年 10月 27日 (木) 20:15:02 JST
Index: affelio/lib/Affelio/SNS/FriendManager.pm
diff -u affelio/lib/Affelio/SNS/FriendManager.pm:1.9 affelio/lib/Affelio/SNS/FriendManager.pm:1.10
--- affelio/lib/Affelio/SNS/FriendManager.pm:1.9 Fri Jul 1 12:38:15 2005
+++ affelio/lib/Affelio/SNS/FriendManager.pm Thu Oct 27 20:15:02 2005
@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# $Id: FriendManager.pm,v 1.9 2005/07/01 03:38:15 slash5234 Exp $
+# $Id: FriendManager.pm,v 1.10 2005/10/27 11:15:02 slash5234 Exp $
package Affelio::SNS::FriendManager;
{
@@ -60,11 +60,11 @@
my $query = 'SELECT count(*) FROM AFuser_CORE_friends';
my $sth;
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
my @row = $sth->fetchrow_array;
@@ -83,11 +83,11 @@
my $query = 'SELECT count(*) FROM AFuser_CORE_friendsfriends';
my $sth;
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
my @row = $sth->fetchrow_array;
@@ -123,11 +123,11 @@
#
$query = "SELECT * FROM AFuser_CORE_friends WHERE af_id = '$af_id'";
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
@row = $sth->fetchrow_array;
@@ -137,11 +137,11 @@
$query = "update AFuser_CORE_friends set timestamp = '$timestamp', password = '$password' where af_id = '$af_id'";
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
Affelio::misc::Debug::debug_print("FM::add_friend:\tUpdated an existing friend.");
Affelio::misc::Debug::debug_print("FM::add_friend: end($row[0]).");
@@ -154,11 +154,11 @@
#Get existing max ID
$query = 'SELECT max(uid) FROM AFuser_CORE_friends';
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
@row = $sth->fetchrow_array;
$maxid = $row[0];
@@ -175,11 +175,11 @@
#If so, we have to move it from F2 table to F1 table.
$query = "SELECT * FROM AFuser_CORE_friendsfriends WHERE af_id = '$af_id'";
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
@row = $sth->fetchrow_array;
@@ -198,18 +198,18 @@
#Delete the record in the F2 table.
$query = "DELETE FROM AFuser_CORE_friendsfriends WHERE uid = $old_uid_in_f2tbl";
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
Affelio::misc::Debug::debug_print("FM::add_friend:\tRecord($old_uid_in_f2tbl) in F2 tbl deleted.");
#Update all other F1 and F2 entries' "flist" column
# from $old_uid_in_f2tbl to $newid
# update sample set data=translate(data,'b','z')
- db_value_replace($af->{db},
+ db_value_replace($af->getDB,
"AFuser_CORE_friendsfriends",
"uid",
"f1list",
@@ -217,7 +217,7 @@
",$newid," ,
);
- db_value_replace($af->{db},
+ db_value_replace($af->getDB,
"AFuser_CORE_friends",
"uid",
"f2list",
@@ -233,11 +233,11 @@
#Insert a new record into my F1 list.
$query = "insert into AFuser_CORE_friends(uid, af_id, nickname, timestamp, password, intro, option_pid,lastupdated,f2list) values ($newid, '$af_id', '$nickname', $timestamp, '$password', ' ', -1, 0, '$old_f1list_in_f2tbl')";
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
Affelio::misc::Debug::debug_print("FM::add_friend:\tInserted a new record.");
@@ -260,18 +260,18 @@
my $q1 = "DELETE FROM AFuser_CORE_friends WHERE uid = $uid";
my $s1;
eval{
- $s1 = $af->{db}->prepare($q1);
+ $s1 = $af->getDB->prepare($q1);
$s1->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
undef($q1);
undef($s1);
Affelio::misc::Debug::debug_print("FM::remove_friend:\t removed entry($uid) from F1 DB");
#Remove uid from friends of others in AFuser_CORE_friends
- db_value_replace($af->{db},
+ db_value_replace($af->getDB,
"AFuser_CORE_friends",
"uid",
"f2list",
@@ -281,7 +281,7 @@
Affelio::misc::Debug::debug_print("FM::remove_friend:\t removed entry($uid) from other's F2list in F1 DB");
#Remove uid from friends of others in AFuser_CORE_friendsfriends
- db_value_replace($af->{db},
+ db_value_replace($af->getDB,
"AFuser_CORE_friendsfriends",
"uid",
"f1list",
@@ -357,11 +357,11 @@
#The guy with F2_AF_ID is in the Friend table?
$query = "SELECT * FROM AFuser_CORE_friends WHERE af_id = '$f2_af_id'";
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
@row_in_f1table = $sth->fetchrow_array;
@@ -386,11 +386,11 @@
Affelio::misc::Debug::debug_print("FM::save_F2List: \tnew_f1_f2list=[$new_f1_f2list]");
$query2 = "update AFuser_CORE_friends set f2list = '$new_f1_f2list' where uid = '$f1_uid'";
eval{
- $sth2 = $af->{db}->prepare($query2);
+ $sth2 = $af->getDB->prepare($query2);
$sth2->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
Affelio::misc::Debug::debug_print("FM::save_F2list: New F1($f1_uid)'s F2list = [$new_f1_f2list]");
@@ -401,11 +401,11 @@
Affelio::misc::Debug::debug_print("FM::save_F2List: \tnew_f2_f1list=[$new_f2_f1list]");
$query2 = "update AFuser_CORE_friends set f2list = '$new_f2_f1list' where uid = $f2_uid";
eval{
- $sth2 = $af->{db}->prepare($query2);
+ $sth2 = $af->getDB->prepare($query2);
$sth2->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
Affelio::misc::Debug::debug_print("FM::save_F2list: New F2($f2_uid)'s F1list = [$new_f2_f1list]");
@@ -416,11 +416,11 @@
#The guy with F2_AF_ID is in the FriendsFriends table?
$query2 = "SELECT * FROM AFuser_CORE_friendsfriends WHERE af_id = '$f2_af_id'";
eval{
- $sth2 = $af->{db}->prepare($query2);
+ $sth2 = $af->getDB->prepare($query2);
$sth2->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
@row_in_f2table = $sth2->fetchrow_array;
@@ -437,11 +437,11 @@
#Get existing min ID
$query3 = 'SELECT min(uid) FROM AFuser_CORE_friendsfriends';
eval{
- $sth3 = $af->{db}->prepare($query3);
+ $sth3 = $af->getDB->prepare($query3);
$sth3->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
@row = $sth3->fetchrow_array;
@@ -457,11 +457,11 @@
my $tmpnewid = $minid-1;
$query3 = "insert into AFuser_CORE_friendsfriends (uid, af_id, nickname, timestamp, f1list) values ('$tmpnewid', '$f2_af_id', '$nickname', $timestamp, ',')";
eval{
- $sth3 = $af->{db}->prepare($query3);
+ $sth3 = $af->getDB->prepare($query3);
$sth3->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
$f2_uid = $minid - 1; #F2 UID is negative!
@@ -484,11 +484,11 @@
Affelio::misc::Debug::debug_print("FM::save_F2List:\tnew_f1_f2list=[$new_f1_f2list]");
$query2 = "update AFuser_CORE_friends set f2list = '$new_f1_f2list' where uid = $f1_uid";
eval{
- $sth2 = $af->{db}->prepare($query2);
+ $sth2 = $af->getDB->prepare($query2);
$sth2->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
#Modify "FriendsFriends" table
@@ -497,11 +497,11 @@
Affelio::misc::Debug::debug_print("FM::save_F2List:\tnew_f2_f1list=[$new_f2_f1list]");
$query2 = "update AFuser_CORE_friendsfriends set f1list = '$new_f2_f1list' where uid = $f2_uid";
eval{
- $sth2 = $af->{db}->prepare($query2);
+ $sth2 = $af->getDB->prepare($query2);
$sth2->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
}#if
@@ -544,11 +544,11 @@
my $query = "SELECT af_id, timestamp, nickname FROM AFuser_CORE_friends WHERE timestamp > " . $req_timestamp;
my $sth;
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
my $retmsg="";
@@ -585,11 +585,11 @@
my $query = 'SELECT * FROM AFuser_CORE_friends order by uid desc';
my $sth;
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
return($sth);
@@ -613,11 +613,11 @@
my $query = "SELECT * FROM AFuser_CORE_friends WHERE uid = $uid";
my $sth;
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
my @row = $sth->fetchrow_array;
if(@row==()) {undef @row};
@@ -642,11 +642,11 @@
my $query = "SELECT * FROM AFuser_CORE_friends WHERE af_id = '$af_id'";
my $sth;
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
my @row = $sth->fetchrow_array;
@@ -671,11 +671,11 @@
my $query = "SELECT $attr FROM AFuser_CORE_friends WHERE uid = '$uid'";
my $sth;
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
my @row = $sth->fetchrow_array;
@@ -698,11 +698,11 @@
my $query = "SELECT $attr FROM AFuser_CORE_friendsfriends WHERE uid = $uid";
my $sth;
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute();
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
my @row = $sth->fetchrow_array;
return($row[0]);
@@ -717,7 +717,7 @@
my $attr = shift; #arg(2) attr (string)
my $af = $self->{af};
- $af_id = $af->{db}->quote($af_id);
+ $af_id = $af->getDB->quote($af_id);
##############################
#retrieve a friend record from DB
@@ -725,11 +725,11 @@
my $sth;
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute;
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
my @row = $sth->fetchrow_array;
@@ -751,7 +751,7 @@
|| ($attr eq "af_id")
|| ($attr eq "nickname")
|| ($attr eq "intro") ){
- $value = $af->{db}->quote($value);
+ $value = $af->getDB->quote($value);
}
##############################
@@ -759,11 +759,11 @@
my $query = "update AFuser_CORE_friends set $attr = $value where uid = $uid";
my $sth;
eval{
- $sth = $af->{db}->prepare($query);
+ $sth = $af->getDB->prepare($query);
$sth->execute;
};
if($@){
- throw Affelio::exception::DBException($af->{db}->errstr);
+ throw Affelio::exception::DBException($af->getDB->errstr);
}
}
Index: affelio/lib/Affelio/SNS/Handshaker_s.pm
diff -u affelio/lib/Affelio/SNS/Handshaker_s.pm:1.21 affelio/lib/Affelio/SNS/Handshaker_s.pm:1.22
--- affelio/lib/Affelio/SNS/Handshaker_s.pm:1.21 Mon Oct 24 17:52:49 2005
+++ affelio/lib/Affelio/SNS/Handshaker_s.pm Thu Oct 27 20:15:02 2005
@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# $Id: Handshaker_s.pm,v 1.21 2005/10/24 08:52:49 slash5234 Exp $
+# $Id: Handshaker_s.pm,v 1.22 2005/10/27 11:15:02 slash5234 Exp $
use strict;
use lib("../../../extlib/");
@@ -114,7 +114,7 @@
# timestamp > req_timestamp
#Retrieve erased friends whose
# timestamp > req_timestamp
- my $retmsg = $af->{fm}->get_updated_friends($req_timestamp);
+ my $retmsg = $af->getFM->get_updated_friends($req_timestamp);
Affelio::misc::Debug::debug_print("server.F2List: ret=[$retmsg]");
Affelio::misc::Debug::debug_print("server.F2List: end.");
@@ -143,7 +143,7 @@
$peer_afid,
$MIMed_mesg) = @_;
- my $passAB = $af->{fm}->get_attribute_by_afid($peer_afid, "password");
+ my $passAB = $af->getFM->get_attribute_by_afid($peer_afid, "password");
if(!defined($passAB) || $passAB eq ""){
return {
flerror => XMLRPC::Data->type('boolean', 1),
@@ -230,7 +230,7 @@
$msg_from = '<A HREF="' . $msg_from . '">' . $msg_from_nickname . '</A>';
- $af->{mesgm}->post_message($msg_from,
+ $af->getMESGM->post_message($msg_from,
$msg_title,
"UserToUser/OneToOne",
$msg_body);
@@ -289,7 +289,7 @@
. "$MIMed_mesg\n"
. MIME::Base64::Perl::encode_base64("\n\nClick following link to approve this request.\n\n$af->{site__web_root}/bin/recv_mail_ack.cgi?id=$sessionid");
- $af->{mesgm}->post_message("Your Affelio",
+ $af->getMESGM->post_message("Your Affelio",
"Link Request from $peer_nickname",
"SystemToUser/LinkRequest/Encode-Base64",
$message_body);
@@ -395,15 +395,15 @@
###########################################
#Add peer to my friends list.
###########################################
- my $uid = $af->{fm}->add_friend($peer_af_id,
+ my $uid = $af->getFM->add_friend($peer_af_id,
$peer_nickname,
$timestamp,
$pass);
Affelio::misc::Debug::debug_print("server.HandShakeReply: add_friend finished.\n");
eval{
- $af->{db}->commit;
- $af->{db}->disconnect;
+ $af->getDB->commit;
+ $af->getDB->disconnect;
undef($af);
};
if($@){
@@ -424,7 +424,7 @@
###########################################
$af = Affelio::SNS::Handshaker_s::Util::af_new();
Affelio::misc::Debug::debug_print("server.HandshakeReply: Let's save peer's flist!");
- $af->{fm}->save_F2List($ret, $peer_af_id);
+ $af->getFM->save_F2List($ret, $peer_af_id);
Affelio::misc::Debug::debug_print("server.HandshakeReply: save_F2List finished.");
#Make a new instance of Affelio
Index: affelio/lib/Affelio/SNS/Handshaker_tmpDB.pm
diff -u affelio/lib/Affelio/SNS/Handshaker_tmpDB.pm:1.3 affelio/lib/Affelio/SNS/Handshaker_tmpDB.pm:1.4
--- affelio/lib/Affelio/SNS/Handshaker_tmpDB.pm:1.3 Fri Jul 1 11:00:09 2005
+++ affelio/lib/Affelio/SNS/Handshaker_tmpDB.pm Thu Oct 27 20:15:02 2005
@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# $Id: Handshaker_tmpDB.pm,v 1.3 2005/07/01 02:00:09 slash5234 Exp $
+# $Id: Handshaker_tmpDB.pm,v 1.4 2005/10/27 11:15:02 slash5234 Exp $
use strict;
use lib("../../../extlib/");
@@ -94,8 +94,8 @@
my $af = $self->{af};
my $str = "insert into $dbname (sessionid, timestamp, af_id, nickname, DH_key_str) values ('$sessionid', '$timestamp', '$af_id', '$nickname', '$DH_key_str')";
- my $sth = $af->{db}->prepare($str);
- $sth->execute() or die $af->{db}->errstr;
+ my $sth = $af->getDB->prepare($str);
+ $sth->execute() or die $af->getDB->errstr;
Affelio::misc::Debug::debug_print("add: end.");
return;
@@ -114,8 +114,8 @@
Affelio::misc::Debug::debug_print("removedb: $sessionid");
my $str = "SELECT sessionid, timestamp, af_id, nickname, DH_key_str FROM $dbname WHERE sessionid= '$sessionid'";
- my $sth = $af->{db}->prepare($str) or die $af->{db}->errstr;
- $sth->execute() or die $af->{db}->errstr;
+ my $sth = $af->getDB->prepare($str) or die $af->getDB->errstr;
+ $sth->execute() or die $af->getDB->errstr;
my @row = $sth->fetchrow_array;
if(!defined(@row)){
@@ -124,7 +124,7 @@
}
my $str = "DELETE FROM $dbname WHERE sessionid=?";
- my $sth = $af->{db}->prepare($str) or die $af->{db}->errstr;
+ my $sth = $af->getDB->prepare($str) or die $af->getDB->errstr;
$sth->execute($sessionid);
Affelio::misc::Debug::debug_print("removedb: end.");