Author Topic: IMC2 emote bug fix  (Read 1843 times)

Offline Tricky

  • BFF
  • ***
  • Posts: 189
  • I like what I code and I code what I like!
    • View Profile
IMC2 emote bug fix
« on: November 23, 2007, 01:52:55 pm »
Here is a small fix to make emotes show the name of the sender...

Code: (/secure/daemon/imc2.c) [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"];
          if(emote && strsrch(data["text"], "$N") == -1) data["text"] = "$N " + data["text"];

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

The specfic line that I added is...

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

Tricky

Offline Alecksy

  • Acquaintance
  • *
  • Posts: 21
    • View Profile
    • BucketMUD
Re: IMC2 emote bug fix
« Reply #1 on: November 23, 2007, 02:03:05 pm »
Here is a small fix to make emotes show the name of the sender...

Thank you very much!
Chil@BucketMUD
www.bucketmud.tk

Offline Tricky

  • BFF
  • ***
  • Posts: 189
  • I like what I code and I code what I like!
    • View Profile
Re: IMC2 emote bug fix
« Reply #2 on: November 23, 2007, 02:38:15 pm »
I should have looked at the protocol page first, forgot about socials. :P

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

Socials have the emote flag set to 2 and the text is pre-compiled by the sending mud to include the sender and target.

Tricky