IF STATEMENT GOING WRONG

Hello! I'm trying to make a sim800l GSM module to send a command based on a received message, and I simply can't understand what's wrong with my code. Any message i send, it's going to enter on the first branch of the IF statement .

void loop() {
  

   lastMessage = getLatestMessageIndex();

   Serial.println(lastMessage);

   
  if (lastMessage!=0){
    

    String msg=readSMS(lastMessage);
  
    if (msg.indexOf("+40741118109")>=0){
      Serial.println("NR OK");
      Serial.println(msg); 
      if (msg.indexOf("PORNESTE">=0)){ //No matter what message i send, it will ALWAYS enter this branch
        Serial.println("PORNESTE, STATE="+state);
        if (state != "ON"){
            const char* number=strdup("telnumber");
            char* text=strdup("ON.1");
            sendSMS(number,text);
            state="ON";
            Serial.println("ON MESSAGE");
    
          }
      }
    
        else{
          if (msg.indexOf("OPRESTE">=0)){
            Serial.println("OPRESTE, STATE="+state);
            if (state != "OFF"){
                const char* number=strdup("telNumber");
                char* text=strdup("OFF.1");
                sendSMS(number,text);
                state="OFF";
                Serial.println("OFF MESSAGE");
        
              }
            }
        }
        
      }
    }
    
}

Have i missed something on this piece of code?...

Nevermind... Of course my code was wrong. 3 hours since i'm trying to fix this piece of code and i didn't saw that i missplaced the bracket from msg.indexOf()

You can press Ctrl-T (or use the menu sequence Tools --> Auto Format) with the cursor in the Source Code Window of the IDE and it automatically reformats your code to a common C style. It can help locate such errors.