Send a PM to yourself

Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

Locked
expstevie
Posts: 13
Joined: 2004-07-13 02:25

Send a PM to yourself

Post by expstevie » 2005-01-11 18:10

I've only just noticed that it's possible to send a PM to yourself, in which case the text appears twice. Any idea if someone has spotted this before (I can't see it after searching the forums) and if it is easily remedied?

At the most simple level, I'd guess that the command to send the PM could be prefixed by an if statement.
If sender != me, sendPM()
I've noticed that an analogous error message appears if you try to download something from yourself.

I've not looked at the actual syntax (as I currently couldn't even say which file it's in!) but is this easily amended or is it beyond someone with 3 days C++ experience?

TheParanoidOne
Forum Moderator
Posts: 1420
Joined: 2003-04-22 14:37

Post by TheParanoidOne » 2005-01-11 19:07

Is it actually a problem?
The world is coming to an end. Please log off.

DC++ Guide | Words

bastya_elvtars
Posts: 164
Joined: 2005-01-06 08:39
Location: HU
Contact:

Post by bastya_elvtars » 2005-01-11 19:41

it can be blocked hub level, where you only see msg once. :)

altho i'd respect the freedom of the paranoid ones :P
Hey you, / Don't help them to bury the light... / Don't give in / Without a fight. (Pink Floyd)

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2005-01-12 03:47

It's a feature, not a bug :wink:
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

ullner
Forum Moderator
Posts: 333
Joined: 2004-09-10 11:00
Contact:

Post by ullner » 2005-01-12 06:17

Why do you want to send a message to yourself?

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2005-01-12 13:19

Why is the text showing up twice a problem? Presumably the first is the local echo, and the second is the remote from the hub. Special-casing this doesn't make any sense to me.

expstevie
Posts: 13
Joined: 2004-07-13 02:25

Post by expstevie » 2005-01-12 18:22

I'm not claiming that this is a problem, let alone a major one. I'm just toying around with the program and compiling it after making tiny changes at my end.
More for practice of C++ than anything else I thought that I might do something like add an if statement to the block of code where PM's are sent.

I know that the code would become hideously bloated if you were to make it completely idiot proof (such as preventing this type of thing) but as I said this is selfishly for my benefit in terms of coding experience rather than for the greater good. You know, one day I might actually contribute something useful! (perish the thought).

One part of my original post still stands - is it as simple a matter as adding a small if statement or am I already out of my depth?

Ta in advance for any pointers.

ullner
Forum Moderator
Posts: 333
Joined: 2004-09-10 11:00
Contact:

Post by ullner » 2005-01-12 18:27

Try and figure out the answer yourself. Everything you need is in PrivateFrame.cpp/h.

expstevie
Posts: 13
Joined: 2004-07-13 02:25

Post by expstevie » 2005-01-12 18:46

Oh - I think I'm at least lukewarm :-)
PrivateFrame.h:
void sendMessage(const tstring& msg) {
if(user && user->isOnline()) {
user->privateMessage(Text::fromT(msg));
string s = "<" + user->getClientNick() + "> " + Text::fromT(msg);
addLine(Text::toT(s));
}

and from PrivateFrame.cpp
void PrivateFrame::gotMessage(const User::Ptr& aUser, const tstring& aMessage) {
PrivateFrame* p = NULL;
Lock l(cs);
FrameIter i = frames.find(aUser);
if(i == frames.end()) {
bool found = false;
for(i = frames.begin(); i != frames.end(); ++i) {
if( (!i->first->isOnline()) &&
(i->first->getNick() == aUser->getNick()) &&
(i->first->getLastHubAddress() == aUser->getLastHubAddress()) )
{

Is it the bold bits alone that I'd be amending by adding an extra statement?

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2005-01-13 12:37

You'd probably be better off using the User::getClientNick() function to get your nickname, and comparing that against the user's nick.

HaArD
Posts: 147
Joined: 2003-01-04 02:20
Location: Canada http://hub-link.sf.net
Contact:

Post by HaArD » 2005-01-13 21:54

I'm just making a suggestion here but doesn't it make a bit more sense to handle this at the time the context menu is presented to the user?

Instead of blocking the transmission of a PM to myself to the hub, why not change the interface so I have no ability to open a PM window to myself?

ivulfusbar
Posts: 506
Joined: 2003-01-03 07:33

Post by ivulfusbar » 2005-01-14 01:31

ohhh why? ooh why? why? i so no reason whatsoever.

And btw, if you want to learn C++, DC++ is absolutely not the best place to start. ;))
Everyone is supposed to download from the hubs, - I don´t know why, but I never do anymore.

Todi
Forum Moderator
Posts: 699
Joined: 2003-03-04 12:16
Contact:

Post by Todi » 2005-01-14 02:42

I like PM'ing myself (don't take that the wrong way). Both through usercommanda and regulary. PM'ing myself notes and the like, as well as PM'ing myself a TTH or filename i found in the search. It's nice.. and i wouldn't want to loose it. I see absolutely no need for such a "feature".

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2005-01-14 05:13

ivulfusbar wrote:if you want to learn C++, DC++ is absolutely not the best place to start. ;))
Wow, there's one good excuse for me if I want to be lazy someday. Could you maybe give some examples on why this is?
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

ullner
Forum Moderator
Posts: 333
Joined: 2004-09-10 11:00
Contact:

Post by ullner » 2005-01-14 07:02

Todi wrote:I like PM'ing myself (don't take that the wrong way). Both through usercommanda and regulary. PM'ing myself notes and the like, as well as PM'ing myself a TTH or filename i found in the search. It's nice.. and i wouldn't want to loose it. I see absolutely no need for such a "feature".
Can't you just use the Notepad? :)

Todi
Forum Moderator
Posts: 699
Joined: 2003-03-04 12:16
Contact:

Post by Todi » 2005-01-14 07:47

Notepad gets hopelessly cluddered after awhile. I like having timestamps of when i wrote something, and having it safely tucked away in my log file.

Herodes
Posts: 26
Joined: 2004-04-08 19:45
Location: Rethymno, Crete, Greece

Post by Herodes » 2005-01-14 11:37

Todi wrote:Notepad gets hopelessly cluddered after awhile. I like having timestamps of when i wrote something, and having it safely tucked away in my log file.
Which brings us to hijacking this thre for asking for a clear button inside NotePad ...
[url=dchub://greekcyprus.no-ip.org].::+LiVe-¦-OnCE-¦-WaiT-¦-foR-¦-eVeR+::..[/url]

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2005-01-14 13:26

Herodes wrote:Which brings us to hijacking this thre for asking for a clear button inside NotePad ...
You'd have to make an Undo button, since someone will press it by mistake. That's much more trouble than it's worth, especially since Control-End Hold Shift Control-Home Release Shift then Delete works.

ivulfusbar
Posts: 506
Joined: 2003-01-03 07:33

Post by ivulfusbar » 2005-01-14 22:54

Guitarm wrote:
ivulfusbar wrote:if you want to learn C++, DC++ is absolutely not the best place to start. ;))
Wow, there's one good excuse for me if I want to be lazy someday. Could you maybe give some examples on why this is?
oooh why do you want to take my freedom away? why do i need to give examples on when and how i use it? ooh why?
Everyone is supposed to download from the hubs, - I don´t know why, but I never do anymore.

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2005-01-15 05:58

Hehe, I was actually trying to be serious. I'm not sure if you misunderstand me here. I just wanted your view in what the best method for learning C++ would be, nothing more - nothing less. You're in joke mode - I understand :)
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

Twink
Posts: 436
Joined: 2003-03-31 23:31
Location: New Zealand

Post by Twink » 2005-02-01 16:12

Why would you want to remove this wonderful feature? I use it heaps.

I private message myself to test things, like testing new chat colours, or testing hub scripts that react to certain words. Its very handy.

mythdl
Posts: 12
Joined: 2003-09-07 03:11

Post by mythdl » 2005-02-02 22:12

Some hub software/scripts depend on the ability to PM yourself (ie. instead of sending commands in the mainchat or to a bot, you send them to yourself).

Also why do we need all these features in the notepad when there is a perfectly good one shipped with windows?

Locked