Author Topic: Fix to show real sender of faked IMC2 socials  (Read 1794 times)

Offline Tricky

  • BFF
  • ***
  • Posts: 189
  • I like what I code and I code what I like!
    • View Profile
Fix to show real sender of faked IMC2 socials
« on: January 23, 2008, 09:04:33 pm »
Find the function channel_in in /decure/daemon/imc2.c and change it to...

Code: [Select]
      void channel_in(string fromname, string frommud, mapping data){
          string sender;
          string localchan;

          int emote=0;

          sender=fromname+"@"+frommud;
          if(data["sender"]) sender = data["sender"];
          if(data["realfrom"]) sender = data["realfrom"];
          if(intp(data["text"])) data["text"]=sprintf("%d",data["text"]);
          if(data["emote"]) emote = data["emote"];
          //Following fix courtesy of Tricky
          if (emote == 1 && strsrch(data["text"], "$N") == -1)
              data["text"] = "$N " + data["text"];

          if (emote == 2 && strsrch(data["text"], sender) == -1)
              data["text"] = data["text"] + " (" + sender + ")";

          data["text"] = imc2_to_pinkfish(data["text"]);
          localchan = CHANNEL_BOT->GetLocalChannel(data["channel"]);
          CHANNEL_BOT->eventSendChannel(sender, localchan, data["text"], emote, "", "");
      }

The fix is a simple check to see if the sender's name is in the social

Code: [Select]
          if (emote == 2 && strsrch(data["text"], sender) == -1)
              data["text"] = data["text"] + " (" + sender + ")";

It isn't perfect but it should make you more aware of who is really sending stuff. It does fall down if their name is referenced in the social but the message makes it look like it came from someone else.

Tricky