[asterisk-commits] seanbright: branch seanbright/res-jabber-astobj2 r114698 - in /team/seanbrigh...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Apr 26 20:54:31 CDT 2008


Author: seanbright
Date: Sat Apr 26 20:54:31 2008
New Revision: 114698

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114698
Log:
Merged revisions 114690,114692,114696 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r114690 | tilghman | 2008-04-26 09:17:19 -0400 (Sat, 26 Apr 2008) | 14 lines

Merged revisions 114689 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114689 | tilghman | 2008-04-26 08:15:21 -0500 (Sat, 26 Apr 2008) | 6 lines

Clicking forward without selecting a message leaves an errant .lock file.
(closes issue #12528)
 Reported by: pukepail
 Patches: 
       patch.diff uploaded by pukepail (license 431)

........

................
r114692 | tilghman | 2008-04-26 11:08:51 -0400 (Sat, 26 Apr 2008) | 2 lines

Unleak reference

................
r114696 | seanbright | 2008-04-26 21:28:32 -0400 (Sat, 26 Apr 2008) | 13 lines

Merged revisions 114695 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114695 | seanbright | 2008-04-26 21:26:15 -0400 (Sat, 26 Apr 2008) | 5 lines

When we don't explicitly pass a path to the --with-tds configure option, we
may end up finding tds.h in /usr/local/include instead of /usr/include.  If
this happens, the grep that looks for the version (from tdsver.h) will fail
and we'll have some problems during the build.

........

................

Modified:
    team/seanbright/res-jabber-astobj2/   (props changed)
    team/seanbright/res-jabber-astobj2/channels/chan_sip.c
    team/seanbright/res-jabber-astobj2/configure
    team/seanbright/res-jabber-astobj2/configure.ac
    team/seanbright/res-jabber-astobj2/contrib/scripts/vmail.cgi

Propchange: team/seanbright/res-jabber-astobj2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/seanbright/res-jabber-astobj2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Apr 26 20:54:31 2008
@@ -1,1 +1,1 @@
-/trunk:1-114685
+/trunk:1-114697

Modified: team/seanbright/res-jabber-astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/seanbright/res-jabber-astobj2/channels/chan_sip.c?view=diff&rev=114698&r1=114697&r2=114698
==============================================================================
--- team/seanbright/res-jabber-astobj2/channels/chan_sip.c (original)
+++ team/seanbright/res-jabber-astobj2/channels/chan_sip.c Sat Apr 26 20:54:31 2008
@@ -13330,6 +13330,7 @@
 	load_realtime = (argc == 5 && !strcmp(argv[4], "load")) ? TRUE : FALSE;
 	if ((peer = find_peer(argv[3], NULL, load_realtime))) {
 		sip_poke_peer(peer, 1);
+		unref_peer(peer, "qualify: done with peer");
 	} else if (type == 0) {
 		ast_cli(fd, "Peer '%s' not found\n", argv[3]);
 	} else {

Modified: team/seanbright/res-jabber-astobj2/configure.ac
URL: http://svn.digium.com/view/asterisk/team/seanbright/res-jabber-astobj2/configure.ac?view=diff&rev=114698&r1=114697&r2=114698
==============================================================================
--- team/seanbright/res-jabber-astobj2/configure.ac (original)
+++ team/seanbright/res-jabber-astobj2/configure.ac Sat Apr 26 20:54:31 2008
@@ -1336,9 +1336,19 @@
 AST_EXT_LIB_CHECK([FREETDS], [tds], [tds_version], [tds.h])
 if test "${PBX_FREETDS}" != "0";
 then
-    case `grep TDS_VERSION_NO ${FREETDS_DIR:-/usr}/include/tdsver.h` in
-	*0.64*)
-		FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_64"
+    if test "${FREETDS_DIR}x" = "x";
+    then
+        for tds_dir in /usr /usr/local;
+        do
+            if test -f "${tds_dir}/include/tdsver.h";
+            then
+                FREETDS_DIR="${tds_dir}"
+            fi
+        done
+    fi
+    case `${GREP} TDS_VERSION_NO ${FREETDS_DIR:-/usr}/include/tdsver.h` in
+    *0.64*)
+        FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_64"
 	;;
     *0.63*)
         FREETDS_INCLUDE="${FREETDS_INCLUDE} -DFREETDS_0_63"

Modified: team/seanbright/res-jabber-astobj2/contrib/scripts/vmail.cgi
URL: http://svn.digium.com/view/asterisk/team/seanbright/res-jabber-astobj2/contrib/scripts/vmail.cgi?view=diff&rev=114698&r1=114697&r2=114698
==============================================================================
--- team/seanbright/res-jabber-astobj2/contrib/scripts/vmail.cgi (original)
+++ team/seanbright/res-jabber-astobj2/contrib/scripts/vmail.cgi Sat Apr 26 20:54:31 2008
@@ -21,7 +21,7 @@
 use Fcntl qw ( O_WRONLY O_CREAT O_EXCL );
 use Time::HiRes qw ( usleep );
 
-$context=""; # Define here your by default context (so you dont need to put voicemail at context in the login
+$context=""; # Define here your by default context (so you dont need to put voicemail at context in the login)
 
 @validfolders = ( "INBOX", "Old", "Work", "Family", "Friends", "Cust1", "Cust2", "Cust3", "Cust4", "Cust5" );
 
@@ -46,10 +46,10 @@
 $astpath = "/_asterisk";
 
 $stdcontainerstart = "<table align=center width=600><tr><td>\n";
-$footer = "<hr><font size=-1><a href=\"http://www.asterisk.org\">The Asterisk Open Source PBX</a> Copyright 2004, <a href=\"http://www.digium.com\">Digium, Inc.</a></a>";
+$footer = "<hr><font size=-1><a href=\"http://www.asterisk.org\">The Asterisk Open Source PBX</a> Copyright 2004-2008, <a href=\"http://www.digium.com\">Digium, Inc.</a></a>";
 $stdcontainerend = "</td></tr><tr><td align=right>$footer</td></tr></table>\n";
 
-sub lock_path() {
+sub lock_path($) {
 
 	my($path) = @_;
 	my $rand;
@@ -80,14 +80,14 @@
 	}
 }
 
-sub unlock_path() {
+sub unlock_path($) {
 
 	my($path) = @_;
 	
 	unlink("$path/.lock");
 }
 
-sub untaint() {
+sub untaint($) {
 
 	my($data) = @_;
 	
@@ -100,7 +100,7 @@
 	return $data;
 }
 
-sub login_screen() {
+sub login_screen($) {
 	print header;
 	my ($message) = @_;
 	print <<_EOH;
@@ -126,7 +126,7 @@
 
 }
 
-sub check_login()
+sub check_login($$)
 {
 	local ($filename, $startcat) = @_;
 	local ($mbox, $context) = split(/\@/, param('mailbox'));
@@ -160,28 +160,28 @@
 			}
 		} elsif (/\[(.*)\]/) {
 			$category = $1;
-                } elsif ($category eq "general") {
-                        if (/([^\s]+)\s*\=\s*(.*)/) {
-                                if ($1 eq "dbname") {
-                                        $dbname = $2;
-                                } elsif ($1 eq "dbpass") {
-                                        $dbpass = $2;
-                                } elsif ($1 eq "dbhost") {
-                                        $dbhost = $2;
-                                } elsif ($1 eq "dbuser") {
-                                        $dbuser = $2;
-                                }
-                        }
-                        if ($dbname and $dbpass and $dbhost and $dbuser) {
-
-                                # db variables are present.  Use db for authentication.
-                                my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost",$dbuser,$dbpass);
-                                my $sth = $dbh->prepare(qq{select fullname,context from voicemail where mailbox='$mbox' and password='$pass' and context='$context'});
-                                $sth->execute();
-                                if (($fullname, $category) = $sth->fetchrow_array()) {;
-                                        return ($fullname ? $fullname : "Extension $mbox in $context",$category);
-                                }
-                        }
+		} elsif ($category eq "general") {
+			if (/([^\s]+)\s*\=\s*(.*)/) {
+				if ($1 eq "dbname") {
+					$dbname = $2;
+				} elsif ($1 eq "dbpass") {
+					$dbpass = $2;
+				} elsif ($1 eq "dbhost") {
+					$dbhost = $2;
+				} elsif ($1 eq "dbuser") {
+					$dbuser = $2;
+				}
+			}
+			if ($dbname and $dbpass and $dbhost and $dbuser) {
+
+				# db variables are present.  Use db for authentication.
+				my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost",$dbuser,$dbpass);
+				my $sth = $dbh->prepare(qq{select fullname,context from voicemail where mailbox='$mbox' and password='$pass' and context='$context'});
+				$sth->execute();
+				if (($fullname, $category) = $sth->fetchrow_array()) {
+					return ($fullname ? $fullname : "Extension $mbox in $context",$category);
+				}
+			}
 		} elsif (($category ne "general") && ($category ne "zonemessages")) { 
 			if (/([^\s]+)\s*\=\>?\s*(.*)/) {
 				@fields = split(/\,\s*/, $2);
@@ -196,7 +196,7 @@
 	return ("", $category);
 }
 
-sub validmailbox()
+sub validmailbox($$$$)
 {
 	local ($context, $mbox, $filename, $startcat) = @_;
 	local $category = $startcat;
@@ -215,7 +215,7 @@
 		$category = "general";
 	}
 	open(VMAIL, "<$filename") || die("Bleh, no $filename");
-	while(<VMAIL>) {
+	while (<VMAIL>) {
 		chomp;
 		if (/include\s\"([^\"]+)\"$/) {
 			($tmp, $category) = &validmailbox($mbox, $context, "/etc/asterisk/$1");
@@ -224,28 +224,28 @@
 			}
 		} elsif (/\[(.*)\]/) {
 			$category = $1;
-                } elsif ($category eq "general") {
-                        if (/([^\s]+)\s*\=\s*(.*)/) {
-                                if ($1 eq "dbname") {
-                                        $dbname = $2;
-                                } elsif ($1 eq "dbpass") {
-                                        $dbpass = $2;
-                                } elsif ($1 eq "dbhost") {
-                                        $dbhost = $2;
-                                } elsif ($1 eq "dbuser") {
-                                        $dbuser = $2;
-                                }
-                        }
-                        if ($dbname and $dbpass and $dbhost and $dbuser) {
-
-                                # db variables are present.  Use db for authentication.
-                                my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost",$dbuser,$dbpass);
-                                my $sth = $dbh->prepare(qq{select fullname,context from voicemail where mailbox='$mbox' and password='$pass' and context='$context'});
-                                $sth->execute();
-				if (($fullname, $context) = $sth->fetchrow_array()) {;
-                                        return ($fullname ? $fullname : "unknown", $category);
-                                }
-                        }
+		} elsif ($category eq "general") {
+			if (/([^\s]+)\s*\=\s*(.*)/) {
+				if ($1 eq "dbname") {
+					$dbname = $2;
+				} elsif ($1 eq "dbpass") {
+					$dbpass = $2;
+				} elsif ($1 eq "dbhost") {
+					$dbhost = $2;
+				} elsif ($1 eq "dbuser") {
+					$dbuser = $2;
+				}
+			}
+			if ($dbname and $dbpass and $dbhost and $dbuser) {
+
+				# db variables are present.  Use db for authentication.
+				my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost",$dbuser,$dbpass);
+				my $sth = $dbh->prepare(qq{select fullname,context from voicemail where mailbox='$mbox' and password='$pass' and context='$context'});
+				$sth->execute();
+				if (($fullname, $context) = $sth->fetchrow_array()) {
+					return ($fullname ? $fullname : "unknown", $category);
+				}
+			}
 		} elsif (($category ne "general") && ($category ne "zonemessages") && ($category eq $context)) {
 			if (/([^\s]+)\s*\=\>?\s*(.*)/) {
 				@fields = split(/\,\s*/, $2);
@@ -282,37 +282,37 @@
 			$tmp .= $tmp2;
 		} elsif (/\[(.*)\]/) {
 			$category = $1;
-                } elsif ($category eq "general") {
-                        if (/([^\s]+)\s*\=\s*(.*)/) {
-                                if ($1 eq "dbname") {
-                                        $dbname = $2;
-                                } elsif ($1 eq "dbpass") {
-                                        $dbpass = $2;
-                                } elsif ($1 eq "dbhost") {
-                                        $dbhost = $2;
-                                } elsif ($1 eq "dbuser") {
-                                        $dbuser = $2;
-                                }
-                        }
-                        if ($dbname and $dbpass and $dbhost and $dbuser) {
-
-                                # db variables are present.  Use db for authentication.
-                                my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost",$dbuser,$dbpass);
-                                my $sth = $dbh->prepare(qq{select mailbox,fullname,context from voicemail where context='$context' order by mailbox});
-                                $sth->execute();
-                                while (($mailbox, $fullname, $category) = $sth->fetchrow_array()) {
-                                        $text = $mailbox;
-                                        if ($fullname) {
-                                                $text .= " (".$fullname.")";
-                                        }
-                                        if ($mailbox eq $current) {
-                                                $tmp .= "<OPTION SELECTED>$text</OPTION>\n";
-                                        } else {
-                                                $tmp .= "<OPTION>$text</OPTION>\n";
-                                        }
-                                }
-                                return ($tmp, $category);
-                        }
+		} elsif ($category eq "general") {
+			if (/([^\s]+)\s*\=\s*(.*)/) {
+				if ($1 eq "dbname") {
+					$dbname = $2;
+				} elsif ($1 eq "dbpass") {
+					$dbpass = $2;
+				} elsif ($1 eq "dbhost") {
+					$dbhost = $2;
+				} elsif ($1 eq "dbuser") {
+					$dbuser = $2;
+				}
+			}
+			if ($dbname and $dbpass and $dbhost and $dbuser) {
+
+				# db variables are present.  Use db for authentication.
+				my $dbh = DBI->connect("DBI:mysql:$dbname:$dbhost",$dbuser,$dbpass);
+				my $sth = $dbh->prepare(qq{select mailbox,fullname,context from voicemail where context='$context' order by mailbox});
+				$sth->execute();
+				while (($mailbox, $fullname, $category) = $sth->fetchrow_array()) {
+					$text = $mailbox;
+					if ($fullname) {
+						$text .= " (".$fullname.")";
+					}
+					if ($mailbox eq $current) {
+						$tmp .= "<OPTION SELECTED>$text</OPTION>\n";
+					} else {
+						$tmp .= "<OPTION>$text</OPTION>\n";
+					}
+				}
+				return ($tmp, $category);
+			}
 		} elsif (($category ne "general") && ($category ne "zonemessages")) {
 			if (/([^\s]+)\s*\=\>?\s*(.*)/) {
 				@fields = split(/\,\s*/, $2);
@@ -587,7 +587,7 @@
 	my $message2;
 	my $msgcount;	
 	my $hasmsg;
-	my $newmessages, $oldmessages;
+	my ($newmessages, $oldmessages);
 	my $format = param('format');
 	if (!$format) {
 		$format = &getcookie('format');
@@ -737,14 +737,14 @@
 sub message_rename()
 {
 	my ($context, $mbox, $oldfolder, $old, $newfolder, $new) = @_;
-	my $oldfile, $newfile;
+	my ($oldfile, $newfile);
 	return if ($old eq $new) && ($oldfolder eq $newfolder);
 
-        if ($context =~ /^(\w+)$/) {
-                $context = $1;
-        } else {
-                die("Invalid Context<BR>\n");
-        }
+	if ($context =~ /^(\w+)$/) {
+		$context = $1;
+	} else {
+		die("Invalid Context<BR>\n");
+	}
 	
 	if ($mbox =~ /^(\w+)$/) {
 		$mbox = $1;
@@ -780,7 +780,7 @@
 	$path =~ /^(.*)$/;
 	$path = $1;
 	mkdir $path, 0770;
-	my $path = "/var/spool/asterisk/voicemail/$context/$mbox/$oldfolder";
+	$path = "/var/spool/asterisk/voicemail/$context/$mbox/$oldfolder";
 	opendir(DIR, $path) || die("Unable to open directory\n");
 	my @files = grep /^msg${old}\.\w+$/, readdir(DIR);
 	closedir(DIR);
@@ -818,7 +818,7 @@
 sub message_copy()
 {
 	my ($context, $mbox, $newmbox, $oldfolder, $old, $new) = @_;
-	my $oldfile, $newfile;
+	my ($oldfile, $newfile);
 	return if ($mbox eq $newmbox);
 	
 	if ($mbox =~ /^(\w+)$/) {
@@ -855,11 +855,11 @@
 	$path =~ /^(.*)$/;
 	$path = $1;
 	mkdir $path, 0770;
-	my $path = "/var/spool/asterisk/voicemail/$context/$newmbox/INBOX";
+	$path = "/var/spool/asterisk/voicemail/$context/$newmbox/INBOX";
 	$path =~ /^(.*)$/;
 	$path = $1;
 	mkdir $path, 0770;
-	my $path = "/var/spool/asterisk/voicemail/$context/$mbox/$oldfolder";
+	$path = "/var/spool/asterisk/voicemail/$context/$mbox/$oldfolder";
 	opendir(DIR, $path) || die("Unable to open directory\n");
 	my @files = grep /^msg${old}\.\w+$/, readdir(DIR);
 	closedir(DIR);
@@ -936,23 +936,27 @@
 	$context = &untaint($context);
 	$newmbox = &untaint($newmbox);
 	my $path = "/var/spool/asterisk/voicemail/$context/$newmbox/INBOX";
-	if (&lock_path($path) == 0) {
-		$msgcount = &msgcount($context, $newmbox, "INBOX");
-		
-		if ($newmbox ne $mbox) {
-#			print header;
-			foreach $msg (@msgs) {
-#				print "Forwarding $msg from $mbox to $newmbox<BR>\n";
-				&message_copy($context, $mbox, $newmbox, $folder, $msg, sprintf "%04d", $msgcount);
-				$msgcount++;
-			}
-			$txt = "Forwarded messages " . join(', ', @msgs) . "to $newmbox";
+	if ($msgs[0]) {
+		if (&lock_path($path) == 0) {
+			$msgcount = &msgcount($context, $newmbox, "INBOX");
+			
+			if ($newmbox ne $mbox) {
+	#			print header;
+				foreach $msg (@msgs) {
+	#				print "Forwarding $msg from $mbox to $newmbox<BR>\n";
+					&message_copy($context, $mbox, $newmbox, $folder, $msg, sprintf "%04d", $msgcount);
+					$msgcount++;
+				}
+				$txt = "Forwarded messages " . join(', ', @msgs) . "to $newmbox";
+			} else {
+				$txt = "Can't forward messages to yourself!\n";
+			}
+			&unlock_path($path); 
 		} else {
-			$txt = "Can't forward messages to yourself!\n";
-		}
-		&unlock_path($path); 
-	} else {
-		$txt = "Cannot forward messages: Unable to lock path.\n";
+			$txt = "Cannot forward messages: Unable to lock path.\n";
+		}
+	} else {
+		$txt = "Please Select Message(s) for this action.\n";
 	}
 	if ($toindex) {
 		&message_index($folder, $txt);
@@ -966,7 +970,7 @@
 	my ($toindex, $del, @msgs) = @_;
 	my $txt;
 	my $path;
-	my $y, $x;
+	my ($y, $x);
 	my $folder = param('folder');
 	my $newfolder = param('newfolder') unless $del;
 	$newfolder =~ s/^(\w+)\s+.*$/$1/;
@@ -981,39 +985,43 @@
 	$context = &untaint($context);
 	$mbox = &untaint($mbox);
 	$folder = &untaint($folder);
-	my $path = "/var/spool/asterisk/voicemail/$context/$mbox/$folder";
-	if (&lock_path($path) == 0) {
-		my $msgcount = &msgcount($context, $mbox, $folder);
-		my $omsgcount = &msgcount($context, $mbox, $newfolder) if $newfolder;
-	#	print header;
-		if ($newfolder ne $folder) {
-			$y = 0;
-			for ($x=0;$x<$msgcount;$x++) {
-				my $msg = sprintf "%04d", $x;
-				my $newmsg = sprintf "%04d", $y;
-				if (grep(/^$msg$/, @msgs)) {
-					if ($newfolder) {
-						&message_rename($context, $mbox, $folder, $msg, $newfolder, sprintf "%04d", $omsgcount);
-						$omsgcount++;
+	$path = "/var/spool/asterisk/voicemail/$context/$mbox/$folder";
+	if ($msgs[0]) {
+		if (&lock_path($path) == 0) {
+			my $msgcount = &msgcount($context, $mbox, $folder);
+			my $omsgcount = &msgcount($context, $mbox, $newfolder) if $newfolder;
+		#	print header;
+			if ($newfolder ne $folder) {
+				$y = 0;
+				for ($x=0;$x<$msgcount;$x++) {
+					my $msg = sprintf "%04d", $x;
+					my $newmsg = sprintf "%04d", $y;
+					if (grep(/^$msg$/, @msgs)) {
+						if ($newfolder) {
+							&message_rename($context, $mbox, $folder, $msg, $newfolder, sprintf "%04d", $omsgcount);
+							$omsgcount++;
+						} else {
+							&message_delete($context, $mbox, $folder, $msg);
+						}
 					} else {
-						&message_delete($context, $mbox, $folder, $msg);
+						&message_rename($context, $mbox, $folder, $msg, $folder, $newmsg);
+						$y++;
 					}
+				}
+				if ($del) {
+					$txt = "Deleted messages "  . join (', ', @msgs);
 				} else {
-					&message_rename($context, $mbox, $folder, $msg, $folder, $newmsg);
-					$y++;
-				}
-			}
-			if ($del) {
-				$txt = "Deleted messages "  . join (', ', @msgs);
+					$txt = "Moved messages "  . join (', ', @msgs) . " to $newfolder";
+				}
 			} else {
-				$txt = "Moved messages "  . join (', ', @msgs) . " to $newfolder";
-			}
+				$txt = "Can't move a message to the same folder they're in already";
+			}
+			&unlock_path($path);
 		} else {
-			$txt = "Can't move a message to the same folder they're in already";
-		}
-		&unlock_path($path);
-	} else {
-		$txt = "Cannot move/delete messages: Unable to lock path.\n";
+			$txt = "Cannot move/delete messages: Unable to lock path.\n";
+		}
+	} else {
+		$txt = "Please Select Message(s) for this action.\n";
 	}
 	# Not as many messages now
 	$msgcount--;




More information about the asterisk-commits mailing list