Index: gigya.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gigya/gigya.inc,v
retrieving revision 1.9
diff -u -p -w -r1.9 gigya.inc
--- gigya.inc	19 Aug 2010 02:17:06 -0000	1.9
+++ gigya.inc	18 Jan 2011 19:23:01 -0000
@@ -381,14 +381,36 @@ function gigya_validate($update = FALSE)
       if (!$update) {
         drupal_set_message(t('Your request signature is invalid. This is most likely caused by invalid site and/or private keys. Gigya is disabled until this error message is cleared.'), 'error');
       }
+      return FALSE;
     }
-    else {
+    elseif ($error == 400006) {
+      if (!$update) {
+        drupal_set_message(t('Your request signature is invalid. This is most likely caused by invalid API key. Gigya is disabled until this error message is cleared.'), 'error');
+      }
+      return FALSE;
+    }
+     elseif ($error == 403007) {
       if (!$update) {
-        drupal_set_message(t('Gigya encountered an error while validating itself. Please check watchdog and try later. If this message keeps appearing please contact gigya or file a bug in the gigya project issue queue.'), 'error');
+        drupal_set_message(t('Your request signature is invalid. This is most likely caused by invalid SecretKey parameter. Gigya is disabled until this error message is cleared.'), 'error');
       }
+      return FALSE;
+    }
+   	elseif  ($error == 400093) {
+      if (!$update) {
+        drupal_set_message(t('Your request signature is invalid. This is most likely caused by invalid API key. Gigya is disabled until this error message is cleared.'), 'error');
     }
     return FALSE;
   }
+    elseif  ($error == 400095 || $error == 403005) {
+      if (!$update && variable_get('need_validation_msg', FALSE) && variable_get('gigya_validate', FALSE)) {
+			drupal_set_message(t('Gigya validated properly. This site is authorized to use Gigya services'));
+    		variable_set('need_validation_msg', TRUE);
+    		 variable_set('gigya_validate', TRUE);
+      		return TRUE;
+   		}
+    }
+
+  }

   if (!$orig_validate_state || variable_get('need_validation_msg', FALSE)) {
     drupal_set_message(t('Gigya validated properly. This site is authorized to use Gigya services'));
@@ -591,14 +613,20 @@ function _gigya_request_failure($results
       if(((int) $result['errorCode']) !== 0){
         $error['type'] = 'gigya';
         $error['code'] = $result['errorCode'];
+        if ($error['code'] == '403005' && variable_get('gigya_validate', FALSE)) {
+          //if this is a validation error and the site was validated then do nothing so we won't litter the watchdog
+        }
+        else {
         $error['message'] = 'Gigya API error '. $result['errorCode'] .': '. $result['errorMessage'];
-        watchdog('gigya', $errormsg, $error['message'], WATCHDOG_WARNING);
+          watchdog('gigya',  $error['message'], NULL, WATCHDOG_WARNING);
+        }
       }
     }
     else{
       $error['type'] = 'gigya';
       $error['code'] = 0;
       $error['message'] = 'Invalid XML response from Gigya service';
+      watchdog('gigya', $error['message'], NULL, WATCHDOG_WARNING);
     }
   }
   else{
