]> jfr.im git - irc.git/blob - software/!RELEASES/ircservices/achurch.org/services/lists/ircservices-coding/2003/002021.html
RELEASE -> !RELEASE
[irc.git] / software / !RELEASES / ircservices / achurch.org / services / lists / ircservices-coding / 2003 / 002021.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
2 <HTML>
3 <HEAD>
4 <TITLE> [IRCServices Coding] Associating NickGroupInfo with two nicks at
5 once
6 </TITLE>
7 <LINK REL="Index" HREF="index.html" >
8 <LINK REL="made" HREF="mailto:ircservices-coding%40ircservices.za.net?Subject=%5BIRCServices%20Coding%5D%20%20Associating%20NickGroupInfo%20with%20two%20nicks%20at%0A%09once&In-Reply-To=200304221424.h3MEO4A24908%40localhost.localdomain">
9 <META NAME="robots" CONTENT="index,nofollow">
10 <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
11 <LINK REL="Previous" HREF="002020.html">
12 <LINK REL="Next" HREF="002022.html">
13 </HEAD>
14 <BODY BGCOLOR="#ffffff">
15 <H1>[IRCServices Coding] Associating NickGroupInfo with two nicks at
16 once</H1>
17 <B>Andrew Church</B>
18 <A HREF="mailto:ircservices-coding%40ircservices.za.net?Subject=%5BIRCServices%20Coding%5D%20%20Associating%20NickGroupInfo%20with%20two%20nicks%20at%0A%09once&In-Reply-To=200304221424.h3MEO4A24908%40localhost.localdomain"
19 TITLE="[IRCServices Coding] Associating NickGroupInfo with two nicks at
20 once">achurch at achurch.org
21 </A><BR>
22 <I>Wed Apr 23 10:17:37 PDT 2003</I>
23 <P><UL>
24 <LI>Previous message: <A HREF="002020.html">[IRCServices Coding] Associating NickGroupInfo with two nicks
25 at once
26 </A></li>
27 <LI>Next message: <A HREF="002022.html">[IRCServices Coding] Associating NickGroupInfo with two
28 nicks atonce
29 </A></li>
30 <LI> <B>Messages sorted by:</B>
31 <a href="date.html#2021">[ date ]</a>
32 <a href="thread.html#2021">[ thread ]</a>
33 <a href="subject.html#2021">[ subject ]</a>
34 <a href="author.html#2021">[ author ]</a>
35 </LI>
36 </UL>
37 <HR>
38 <!--beginarticle-->
39 <PRE> The code currently assumes that at most one user will be associated
40 with any particular nickname, that NickInfo.user will point at the user
41 with nickname NickInfo.nick, that User.ni will point at the NickInfo with
42 nickname User.nick (or NULL if the nickname is not registered), and that
43 User.ngi will point to a nickname group containing User.ni (or NULL or
44 NICKGROUPINFO_INVALID). Breaking any of these assumptions will probably
45 cause many weird and dangerous things to happen.
46
47 Note that two or more users can be associated with a single nick group
48 (if, for example, someone has two clients open and using two linked nicks).
49 However, if the user's nick is not in NickGroupInfo.nicks[], things will
50 probably break.
51
52 I'd strongly suggest finding another way to accomplish whatever you're
53 trying to do without an &quot;su&quot;-like command.
54
55 --Andrew Church
56 <A HREF="http://www.ircservices.za.net/mailman/listinfo/ircservices-coding">achurch at achurch.org</A>
57 <A HREF="http://achurch.org/">http://achurch.org/</A>
58
59 &gt;<i>Hi, we're writing a module which allows a web interface to &quot;su&quot; to a nickname, similar to the way the unix &quot;su&quot; command (dont ask! :)) heres how it works:
60 </I>&gt;<i>
61 </I>&gt;<i>basically, /msg somepseudoclient su &lt;nick&gt; &lt;pass&gt;
62 </I>&gt;<i>
63 </I>&gt;<i>..and you gain the privilages of that nick, wether or not they are using it at the time. What we're doing at the moment is associating the user's ngi and ni fields with the nickgroupinfo of the registered nickname, e.g.
64 </I>&gt;<i>
65 </I>&gt;<i>NickInfo* MyNickInf = get_nickinfo(somenick);
66 </I>&gt;<i>NickGroupInfo* MyNGroupInf = get_ngi(MyNickInf);
67 </I>&gt;<i>
68 </I>&gt;<i>u-&gt;ngi = MyNGroupInf;
69 </I>&gt;<i>u-&gt;ni = MyNickInf;
70 </I>&gt;<i>/* user u is now logged in with privilages of &quot;ngi&quot; nick, send +r as a raw if neccessary */
71 </I>&gt;<i>
72 </I>&gt;<i>sorry for any errors in this code, im typing it off the top of my head.
73 </I>&gt;<i>Basically, the problem we have is, that only one nick can have &quot;ownership&quot; of a groupinfo at any one time, if we associate user 'u' with MyNGroupInf, then if some other user online at the time (lets call them u2) has this same association (u2-&gt;ngi == MyNG
74 </I>&gt;<i>roupInf) than u2 is logged out (and has to re-identify using /msg nickserv identify &lt;pass&gt;). Basically we cant give two people ownership of the same nickgroup at the same time. Is there any way we can get around this, e.g. by memcpy'ing the NickGroupInfo?
75 </I>&gt;<i> The ownership of the nick by the second user only needs to be temporary, until disconnect, so there shouldnt be any corruption of services DB's by having two people pointing at the same nickgroup in the file, or anything as weird as that :)
76 </I>&gt;<i>
77 </I>&gt;<i>If theres any way to solve this problem simply, without needing andy to rewrite the core, or for us to approach the problem a different way, we'd be grateful of anyone could tell us how :)
78 </I>&gt;<i>
79 </I>&gt;<i>Thanks,
80 </I>&gt;<i>Brain
81 </I>&gt;<i>ChatSpike Services-dev
82 </I>&gt;<i>
83 </I>&gt;<i>
84 </I>&gt;<i>
85 </I>&gt;<i>------------------------------------------------------------------
86 </I></PRE>
87
88 <!--endarticle-->
89 <HR>
90 <P><UL>
91 <!--threads-->
92 <LI>Previous message: <A HREF="002020.html">[IRCServices Coding] Associating NickGroupInfo with two nicks
93 at once
94 </A></li>
95 <LI>Next message: <A HREF="002022.html">[IRCServices Coding] Associating NickGroupInfo with two
96 nicks atonce
97 </A></li>
98 <LI> <B>Messages sorted by:</B>
99 <a href="date.html#2021">[ date ]</a>
100 <a href="thread.html#2021">[ thread ]</a>
101 <a href="subject.html#2021">[ subject ]</a>
102 <a href="author.html#2021">[ author ]</a>
103 </LI>
104 </UL>
105
106 </body></html>