Handling the differet cellphone providers with an enumeration instead of using something more dynamically (or rather runtime-) configurable requires rebuilding the app when providers are added or vanish or when the name of their SMS handling server changes.

Moving from DNS names to IP addressing is most certainly not an improvement.

The "goto Label_005B" is particularly amusing. What weed was this guy smoking?

3. The "goto Label_005B" is particularly amusing. What weed was this guy smoking?

Since the code was decompiled (not the original source code), is it possible that the decompiler added the goto? Or rather the original compiler translated break into goto (but didn't for the last one)?

Yes, and when William the Conqueror showed up on the shores of Britain in 1066 he found everyone speaking the same English we do today. Since, you know, the language never changes and words never take on new meanings and/or usages. Never.

3. The "goto Label_005B" is particularly amusing. What weed was this guy smoking?

Since the code was decompiled (not the original source code), is it possible that the decompiler added the goto? Or rather the original compiler translated break into goto (but didn't for the last one)?

the label name is obviously generated by a decompiler. It didn't add any gotos, that's how switches wind up being compiled. You can see it yourself: write some code in java or a .net language, then use javap or ildasm.

All smtp uses email's domain to understad where it's send to ... if you just put the ip of the mail server it would:

Not work due to not finding corresponding mail server

In case I missed the part of SMTP 101 where it's possible to relay to an IP ... how would the receiving server know where to host it into?

Soooo... you don't actually know what an IP is, do you? When a mail server (or anything else) uses a domain name to route traffic, it does so by first using DNS to translate that name into an IP; the IP address is what's actually used to figure out where traffic should go. Domain names are just to assist humans.

Maximilianop: You can e-mail an IP address just fine. When you send an e-mail, it will try to get its mx record, if one does not exist, it will go to its A record. Or in the case of an IP address, straight to the IP and attempt the delivery.

The way this guy is doing it is not optimal, but if there is a mailserver on that IP and it has a default domain, it'll likely be delivered.

Ok, sooo how will this even work?
All smtp uses email's domain to understad where it's send to ... if you just put the ip of the mail server it would:

Not work due to not finding corresponding mail server

As long as the IP address is right, there's a strong chance that it will go to the right place. Of course, that's a massive proviso as it depends on these providers never ever changing their SMTP/SMS gateway machines' IP addresses.

2. In case I missed the part of SMTP 101 where it's possible to relay to an IP ... how would the receiving server know where to host it into?

Provided it's to a mailbox that is "local" to the receiving server, it will work. But is the gateway able to do the translation to SMS itself or does it go onward by SMTP internally first? Who knows, but if it is the second, delivering to IP will almost certainly break massively anyway...

I work on an SMSC, my guess is the WTF here is that he didn't interface using SMPP, the industry standard for sending short messages like grown-ups.

My guess is the company didn't want to pay to send text messages.

This way the company can send all the text messages they want with out paying a dime. I know it's not the best way, but I'm guessing this was their line of thought. I had to deal with a situation exactly like this before.

All right, lets say this program is put into production and then the primary dies for good and a backup (if they have one) becomes active. Now the ipaddress might be different... oops got to recompile the code :)

@Pawel: Any programmer should have realized that the carriers should be configgable. The non-code WTF is much bigger, though (the substitution of IP addies, making it much more fragile). On the other claw, maybe the contractor was just setting himself up for more work later, when the app needed "updating"....

@SuperJason: The guy who initially implemented a web-based email/SMS distribution system I once worked on, apparently didn't think it was a bad idea, nor did I, nor our boss. However, the carriers were configgable, including via the web interface (if you were logged in as an admin). The hardcoding is the initial "real WTF", followed by the bigger-WTF of the "ip calls".

if you can send these "text messages" on a cell phone, where do you plug in the damn keyboard? This seems dumb, I don't want to carry around my fully functional keyboard in my pocket when i want to send a "text message". I'll stick to carrier pigeons and telegraphs!!!!

question for pondering: considering how similar (in function) pagers and sms are, how come they can't communicate with each other via some intermediate? Obviously a pager and a cell phone operate on different frequencies and protocols, but how come there's not a phone number you can SMS and it'll send a page, and vice versa?

question for pondering: considering how similar (in function) pagers and sms are, how come they can't communicate with each other via some intermediate? Obviously a pager and a cell phone operate on different frequencies and protocols, but how come there's not a phone number you can SMS and it'll send a page, and vice versa?

They can't? I always assumed pagers where just mobile phones without the voice function. But then, having grown up in the mobile age, I've only ever seen a pager on /Scrubs/. I don't think pagers are used at all in Europe/Asia where SMS is ubiquitous, except maybe by emergency workers.

So how does a pager work if it isn't a phone? Are you telling me we have an entire wireless network just to support something no one uses anymore?

Yeah, that was an example of the original code, not my code, though I love making all my functions return "object". Looks like I made a change to make Resharper shut up. I hearby vow not to introduce any more Resharper fixes :). Wait, why am I defending code I posted in a forum...

I'm sorry, the remark on the 'better paid' was not ment for you, but for the orginal coder. I figured you posted the code the orginal coder writen, not you :)